Don't dump setval(...) for 'bdr' sequences bdr-pg/REL9_4_2-1
authorCraig Ringer <craig@2ndquadrant.com>
Tue, 26 May 2015 02:24:20 +0000 (10:24 +0800)
committerCraig Ringer <craig@2ndquadrant.com>
Tue, 26 May 2015 02:24:20 +0000 (10:24 +0800)
commit3ab2f7889f6b20a1cd21c5609861e1af841060c0
tree8b793809f92c2fe646d4a6c5376c437871915e5b
parent1592812131d84de56ba258c333f936e5e19647e2
Don't dump setval(...) for 'bdr' sequences

BDR sequence state is stored in the BDR extension data. It is neither
necessary nor - currently - supported to setval(...) a 'bdr' sequence.
Attempting to do so in dumps meant we had to ignore errors on restore.

Note that this fix isn't perfect. We CREATE SEQUENCE ... USING 'bdr',
which will start sequence voting immediately unless
--single-transaction is used. If pg_restore or a dump script executed
by 'psql' concurrently creates extension data this may result in
unique violations. The sequence should only be created after we've
restored bdr.bdr_sequence_values but pg_dump doesn't offer a way for a
sequence (which is considered schema) to depend on table data. This
issue is not addressed in this commit, but will only arise if you are
restoring a dump to an empty but active BDR system, rather then to a
standalone node before promotion to a BDR master.

(A possible workaround would be to CREATE the sequence as local, then
ALTER SEQUENCE ... USING 'bdr' in dumpSequenceData, but this means
that schema-only dumps will lose knowledge of the sequence access
method.)
src/bin/pg_dump/pg_dump.c