From: | Ville Rantamaula <ville(dot)rantamaula(at)gmail(dot)com> |
---|---|
To: | Ruth Melendo <rmelendo(at)teltronic(dot)es> |
Cc: | "[ADMIN]" <pgsql-admin(at)postgresql(dot)org> |
Subject: | Re: PostgreSQL with BDR. Problems when adding a sequence in a table column |
Date: | 2015-03-04 11:01:32 |
Message-ID: | CAGf-6h-dPBbECupt0XVwWa=YZE1Ja+L797atHHw1WURKvMqX1A@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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(at)teltronic(dot)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(at)postgresql(dot)org [mailto:
> pgsql-admin-owner(at)postgresql(dot)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(at)teltronic(dot)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]
>
>
>
>
>
From | Date | Subject | |
---|---|---|---|
Next Message | Jim Nasby | 2015-03-05 08:25:42 | Re: Re: [pgadmin-support] Issue with a hanging apply process on the replica db after vacuum works on primary |
Previous Message | Vladimir Borodin | 2015-03-04 08:34:40 | Re: Replication: re-initialisation of failed master |