pgsql: pg_dump: Fix gathering of sequence information.

Поиск
Список
Период
Сортировка
От Nathan Bossart
Тема pgsql: pg_dump: Fix gathering of sequence information.
Дата
Msg-id E1veF8i-005Wmk-2S@gemulon.postgresql.org
обсуждение исходный текст
Список pgsql-committers
pg_dump: Fix gathering of sequence information.

Since commit bd15b7db48, pg_dump uses pg_get_sequence_data() (née
pg_sequence_read_tuple()) to gather all sequence data in a single
query as opposed to a query per sequence.  Two related bugs have
been identified:

* If the user lacks appropriate privileges on the sequence, pg_dump
generates a setval() command with garbage values instead of
failing as expected.

* pg_dump can fail due to a concurrently dropped sequence, even if
the dropped sequence's data isn't part of the dump.

This commit fixes the above issues by 1) teaching
pg_get_sequence_data() to return nulls instead of erroring for a
missing sequence and 2) teaching pg_dump to fail if it tries to
dump the data of a sequence for which pg_get_sequence_data()
returned nulls.  Note that pg_dump may still fail due to a
concurrently dropped sequence, but it should now only do so when
the sequence data is part of the dump.  This matches the behavior
before commit bd15b7db48.

Bug: #19365
Reported-by: Paveł Tyślacki <pavel.tyslacki@gmail.com>
Suggested-by: Tom Lane <tgl@sss.pgh.pa.us>
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/19365-6245240d8b926327%40postgresql.org
Discussion: https://postgr.es/m/2885944.1767029161%40sss.pgh.pa.us
Backpatch-through: 18

Branch
------
REL_18_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/39d55557661f6d2fc0b5781b3f40390ca4febdad

Modified Files
--------------
src/backend/commands/sequence.c | 14 ++++++++------
src/bin/pg_dump/pg_dump.c       | 12 ++++++++++++
2 files changed, 20 insertions(+), 6 deletions(-)


В списке pgsql-committers по дате отправления: