Postgres sequence not in sync

I run setup with several wizards with bucardo and postgres.

I find that some of my table sequences are out of sync with each other. In particular, an automatically increasing identifier.

Example:

db1 - table1

INSERT INTO distributors (did, dname) VALUES (DEFAULT, 'XYZ Widgets')

Newline Id is 1

db2 - table1

INSERT INTO distributors (did, dname) VALUES (DEFAULT, 'XYZ Widgets')

Newline Id is 1

The newline id on db2 should be 2, since bucardo replicates data from db1, but auto increment db2 is based on:

nextval('oauth_sessions_id_seq'::regclass)

And if we check "oauth_sessions_id_seq", we will see the last value as 0.

phew ... make sense?

Anyway, can I do one of the following?

  • Replicate session tables with bucardo so that every database session is shared?

  • , ?

- , , . , .

+4
1

, FAQ Bucardo FAQ.

Bucardo DDL?

, Bucardo , Postgres DDL .

Bucardo , "" , , . , , . , - INSERT, .

SELECT setval('oauth_sessions_id_seq', (SELECT MAX(did) FROM distributors));

. .

, . , , Bucardo , , , - UPSERT. . . "" :

INSERT INTO  distributors (did, dname) 
    VALUES ((SELECT max(did)+1 FROM distributors), 'XYZ Widgets');
+3

All Articles