[Bucardo-general] support for primary key column with a sequence as the default value

Greg Sabino Mullane greg at endpoint.com
Wed Jan 20 17:35:16 UTC 2010


> I was wondering if Bucardo supports the replication of data in tables
> whose primary key contains a column with a sequence as the default
> value.  For example:

Certainly. The only important parts are the data type (bigint in your
example), and that the table has a primary key.

> CREATE SEQUENCE user_id_sequence START 2147483648;
> 
> CREATE TABLE "user"( "user_id" Bigint DEFAULT
> nextval('user_id_sequence') NOT NULL, "user_name" Character
> varying(30) NOT NULL ) WITH (OIDS=FALSE);
> 
> ALTER TABLE "user" ADD CONSTRAINT "user_P1" PRIMARY KEY ("user_id");
> 
> INSERT INTO public.user (user_name) VALUES ('omar');
> 
> When I test the above setup, Bucardo doesn't seem to replicate the
> row resulting from the INSERT statement from the master to the slave.
> However, the following does work:

Check the logs - they are very verbose and should tell you exactly what
is happening. Check that the table on the master has bucardo_delta
triggers, that an insert to the table populated bucardo_delta, and that
no errors appear in the Bucardo logs.

> INSERT INTO public.user (user_id, user_name) VALUES
> (nextval('user_id_sequence'), 'omar')
> 
> Any ideas ?

It's remotely possible the use of reserved words and thus forced quoting
of the table name ("user") has something to do with it, but without the
logs, it's impossible to tell.

-- 
Greg Sabino Mullane greg at endpoint.com
End Point Corporation
PGP Key: 0x14964AC8

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 163 bytes
Desc: OpenPGP digital signature
Url : https://mail.endcrypt.com/pipermail/bucardo-general/attachments/20100120/6a74d4ca/attachment.bin 


More information about the Bucardo-general mailing list