0

I need to be able to create a new column in an existing table in a database that has been set up to use postgresql UDR. From what I've read, you cannot run DDL commands in BDR unless you write the syntax in a specific way... For example, I found this post on stackoverflow:

Django 1.8 Migration with Postgres BDR 9.4.1

I've tried to follow something similar with my UDR setup... but it's not working for me.

Specifically, I've tried the following:

mydatabase=# alter table mytable add column newcolumn character varying(50) not null default 'boo';
ERROR:  ALTER TABLE ... ADD COLUMN ... DEFAULT may only affect UNLOGGED or TEMPORARY tables when BDR is active; mytable is a regular table

and this:

mydatabase=# alter table mytable add column newcolumn character varying(50);
ERROR:  No peer nodes or peer node count unknown, cannot acquire DDL lock
HINT:  BDR is probably still starting up, wait a while
mydatabase=# 

Are you allowed to run DDL commands in a UDR setup? If anyone has some tips, I'd appreciate it. thanks.

Community
  • 1
  • 1
Happydevdays
  • 1,982
  • 5
  • 31
  • 57
  • 1
    What is Postgres **UDR**? I know BDR, but not UDR –  Feb 05 '16 at 20:22
  • replication from a master to a slave. uni-directional vs. bi-directional – Happydevdays Feb 05 '16 at 20:23
  • 2
    So you mean a "standard" streaming replication setup (the built-in replication)? Yes, you can run *any* DDL statement on the master there –  Feb 05 '16 at 20:33
  • except it's using postgresql bdr to do it. you can set postgresql-bdr package to do either bdr or udr. if it can do it, would you mind posting some details re: how / where you think i've gone astray? btw. i'm just taking over an existing db set up by my predecessor. – Happydevdays Feb 05 '16 at 21:13
  • https://wiki.postgresql.org/images/a/a8/Udr-pgconf.pdf – Happydevdays Feb 05 '16 at 21:38
  • and also http://bdr-project.org/docs/0.9.0/functions-node-mgmt.html fwiw. Both links make reference to UDR – Happydevdays Feb 05 '16 at 21:59
  • As it says in that PDF, you need to run DDL via `bdr_replicate_ddl_command()`. – Nick Barnes Feb 06 '16 at 02:16
  • yeah. i missed that the first time. but after posting my comment with the link, i noticed it ... going to try it out this morning – Happydevdays Feb 08 '16 at 13:15
  • omg u have 420 reputation. u r a god. pls no one up vote or downvote this user's questions – Cameron Oct 23 '16 at 20:40

0 Answers0