pg.ddx.io pgsql-admin@postgresql.org mailing list archive
help / color / mirror / Atom feedPostgreSQL with BDR. Problems when adding a sequence in a table column
4+ messages / 3 participants
[nested] [flat]
* PostgreSQL with BDR. Problems when adding a sequence in a table column
@ 2015-03-02 10:05 Ruth Melendo <rmelendo@teltronic.es>
0 siblings, 1 reply; 4+ messages in thread
From: Ruth Melendo @ 2015-03-02 10:05 UTC (permalink / raw)
To: 'Technical Doubts' <online.technicaldoubts@gmail.com>; pgsql-admin
Hi,
How can I fix this in a database with BDR?
... ALTER TABLE … ADD COLUMN …. DEFAULT may only affect UNLOGGED or TEMPORARY
tables when BDR is active; test_table is a regular table
This error happens when trying to add a column to a table with a sequence.
Thanks in advance!
Ruth Patricia Melendo Ventura
Software Engineer
TELTRONIC, S.A.U.
T: +34 976 465656 Ext. 179
F: +34 976 465722
<http://www.teltronic.es/; www.teltronic.es
Logo40
Attachments:
image001.jpg (image/jpeg, 1.6K) download
view image
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: PostgreSQL with BDR. Problems when adding a sequence in a table column
@ 2015-03-02 12:53 Greg Spiegelberg <gspiegelberg@gmail.com>
parent: Ruth Melendo <rmelendo@teltronic.es>
0 siblings, 1 reply; 4+ messages in thread
From: Greg Spiegelberg @ 2015-03-02 12:53 UTC (permalink / raw)
To: Ruth Melendo <rmelendo@teltronic.es>; +Cc: Technical Doubts <online.technicaldoubts@gmail.com>; pgsql-admin
Hi Ruth,
You need to create the sequence first USING BDR then alter the table
setting DEFAULT nextval('..._seq').
CREATE SEQUENCE my_id_seq USING BDR;
Make sure your table has a primary key for BDR.
HTH.
-Greg
On Mon, Mar 2, 2015 at 3:05 AM, Ruth Melendo <rmelendo@teltronic.es> wrote:
> Hi,
>
>
>
> How can I fix this in a database with BDR?
>
>
>
> ... ALTER TABLE … ADD COLUMN …. DEFAULT may only affect UNLOGGED or
> TEMPORARY
>
> tables when BDR is active; test_table is a regular table
>
>
>
> This error happens when trying to add a column to a table with a sequence.
>
>
>
> Thanks in advance!
>
>
>
> *Ruth Patricia Melendo Ventura*
>
> *Software Engineer*
>
> TELTRONIC, S.A.U.
>
> T: +34 976 465656 Ext. 179
>
> F: +34 976 465722
>
> www.teltronic.es
>
> [image: Logo40]
>
>
>
Attachments:
image001.jpg (image/jpeg, 1.6K) download
view image
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: PostgreSQL with BDR. Problems when adding a sequence in a table column
@ 2015-03-02 13:27 Ruth Melendo <rmelendo@teltronic.es>
parent: Greg Spiegelberg <gspiegelberg@gmail.com>
0 siblings, 1 reply; 4+ messages in thread
From: Ruth Melendo @ 2015-03-02 13:27 UTC (permalink / raw)
To: 'Greg Spiegelberg' <gspiegelberg@gmail.com>; +Cc: 'Technical Doubts' <online.technicaldoubts@gmail.com>; pgsql-admin
Hi,
Tried but same error appeared:
ERROR: ALTER TABLE ... ADD COLUMN ... DEFAULT may only affect UNLOGGED or TEMPORARY tables when BDR is active; test_table is a regular table
********** Error **********
I created the sequence using BDR and after that tried to alter table adding the column
CREATE SEQUENCE test_serial_bdr2 USING BDR;
ALTER TABLE test_table add column sec2 INTEGER PRIMARY KEY NOT NULL DEFAULT nextval('test_serial_bdr2');
Ruth Patricia Melendo Ventura
Software Engineer
TELTRONIC, S.A.U.
T: +34 976 465656 Ext. 179
F: +34 976 465722
<http://www.teltronic.es/; www.teltronic.es
Logo40
De: pgsql-admin-owner@postgresql.org [mailto:pgsql-admin-owner@postgresql.org] En nombre de Greg Spiegelberg
Enviado el: lunes, 02 de marzo de 2015 13:53
Para: Ruth Melendo
CC: Technical Doubts; [ADMIN]
Asunto: Re: [ADMIN] PostgreSQL with BDR. Problems when adding a sequence in a table column
Hi Ruth,
You need to create the sequence first USING BDR then alter the table setting DEFAULT nextval('..._seq').
CREATE SEQUENCE my_id_seq USING BDR;
Make sure your table has a primary key for BDR.
HTH.
-Greg
On Mon, Mar 2, 2015 at 3:05 AM, Ruth Melendo <rmelendo@teltronic.es> wrote:
Hi,
How can I fix this in a database with BDR?
... ALTER TABLE … ADD COLUMN …. DEFAULT may only affect UNLOGGED or TEMPORARY
tables when BDR is active; test_table is a regular table
This error happens when trying to add a column to a table with a sequence.
Thanks in advance!
Ruth Patricia Melendo Ventura
Software Engineer
TELTRONIC, S.A.U.
T: +34 976 465656 <tel:%2B34%20976%20465656%C2%A0%C2%A0%20Ext.%20179> Ext. 179
F: +34 976 465722 <tel:%2B34%20976%20465722>
<http://www.teltronic.es/; www.teltronic.es
Logo40
Attachments:
image002.jpg (image/jpeg, 1.6K) download
view image
image003.jpg (image/jpeg, 1.6K) download
view image
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: PostgreSQL with BDR. Problems when adding a sequence in a table column
@ 2015-03-04 11:01 Ville Rantamaula <ville.rantamaula@gmail.com>
parent: Ruth Melendo <rmelendo@teltronic.es>
0 siblings, 0 replies; 4+ messages in thread
From: Ville Rantamaula @ 2015-03-04 11:01 UTC (permalink / raw)
To: Ruth Melendo <rmelendo@teltronic.es>; +Cc: pgsql-admin
Hi Ruth,
You can make it work, if you split the ALTER TABLE statement to two parts
like this:
CREATE SEQUENCE test_serial_bdr2 USING BDR;
ALTER TABLE test_table add column sec2 bigint primary key not null;
ALTER TABLE test_table alter column sec2 SET DEFAULT
nextval('test_serial_bdr2');
Yours,
Ville
2015-03-02 15:27 GMT+02:00 Ruth Melendo <rmelendo@teltronic.es>:
> Hi,
>
>
>
> Tried but same error appeared:
>
>
>
> ERROR: ALTER TABLE ... ADD COLUMN ... DEFAULT may only affect UNLOGGED or
> TEMPORARY tables when BDR is active; test_table is a regular table
>
> ********** Error **********
>
>
>
> I created the sequence using BDR and after that tried to alter table
> adding the column
>
>
>
> CREATE SEQUENCE test_serial_bdr2 USING BDR;
>
>
>
> ALTER TABLE test_table add column sec2 INTEGER PRIMARY KEY NOT NULL
> DEFAULT nextval('test_serial_bdr2');
>
>
>
>
>
>
>
> *Ruth Patricia Melendo Ventura*
>
> *Software Engineer*
>
> TELTRONIC, S.A.U.
>
> T: +34 976 465656 Ext. 179
>
> F: +34 976 465722
>
> www.teltronic.es
>
> [image: Logo40]
>
>
>
> *De:* pgsql-admin-owner@postgresql.org [mailto:
> pgsql-admin-owner@postgresql.org] *En nombre de *Greg Spiegelberg
> *Enviado el:* lunes, 02 de marzo de 2015 13:53
> *Para:* Ruth Melendo
> *CC:* Technical Doubts; [ADMIN]
> *Asunto:* Re: [ADMIN] PostgreSQL with BDR. Problems when adding a
> sequence in a table column
>
>
>
> Hi Ruth,
>
>
>
> You need to create the sequence first USING BDR then alter the table
> setting DEFAULT nextval('..._seq').
>
>
>
> CREATE SEQUENCE my_id_seq USING BDR;
>
>
>
> Make sure your table has a primary key for BDR.
>
>
>
> HTH.
>
> -Greg
>
>
>
> On Mon, Mar 2, 2015 at 3:05 AM, Ruth Melendo <rmelendo@teltronic.es>
> wrote:
>
> Hi,
>
>
>
> How can I fix this in a database with BDR?
>
>
>
> ... ALTER TABLE … ADD COLUMN …. DEFAULT may only affect UNLOGGED or
> TEMPORARY
>
> tables when BDR is active; test_table is a regular table
>
>
>
> This error happens when trying to add a column to a table with a sequence.
>
>
>
> Thanks in advance!
>
>
>
> *Ruth Patricia Melendo Ventura*
>
> *Software Engineer*
>
> TELTRONIC, S.A.U.
>
> T: +34 976 465656 Ext. 179
>
> F: +34 976 465722
>
> www.teltronic.es
>
> [image: Logo40]
>
>
>
>
>
Attachments:
image002.jpg (image/jpeg, 1.6K) download
view image
image003.jpg (image/jpeg, 1.6K) download
view image
^ permalink raw reply [nested|flat] 4+ messages in thread
end of thread, other threads:[~2015-03-04 11:01 UTC | newest]
Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2015-03-02 10:05 PostgreSQL with BDR. Problems when adding a sequence in a table column Ruth Melendo <rmelendo@teltronic.es>
2015-03-02 12:53 ` Greg Spiegelberg <gspiegelberg@gmail.com>
2015-03-02 13:27 ` Ruth Melendo <rmelendo@teltronic.es>
2015-03-04 11:01 ` Ville Rantamaula <ville.rantamaula@gmail.com>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox