Commit 7a485bd
committed
pg_dump: Fix gathering of sequence information.
Since commit bd15b7d, 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 bd15b7d.
Bug: #19365
Reported-by: Paveł Tyślacki <[email protected]>
Suggested-by: Tom Lane <[email protected]>
Reviewed-by: Tom Lane <[email protected]>
Discussion: https://postgr.es/m/19365-6245240d8b926327%40postgresql.org
Discussion: https://postgr.es/m/2885944.1767029161%40sss.pgh.pa.us
Backpatch-through: 181 parent 24cb3a0 commit 7a485bd
2 files changed
+20
-6
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1794 | 1794 | | |
1795 | 1795 | | |
1796 | 1796 | | |
1797 | | - | |
1798 | 1797 | | |
1799 | 1798 | | |
1800 | 1799 | | |
| |||
1811 | 1810 | | |
1812 | 1811 | | |
1813 | 1812 | | |
1814 | | - | |
| 1813 | + | |
1815 | 1814 | | |
1816 | 1815 | | |
1817 | | - | |
1818 | | - | |
| 1816 | + | |
| 1817 | + | |
| 1818 | + | |
1819 | 1819 | | |
1820 | | - | |
| 1820 | + | |
| 1821 | + | |
1821 | 1822 | | |
1822 | 1823 | | |
1823 | 1824 | | |
| |||
1838 | 1839 | | |
1839 | 1840 | | |
1840 | 1841 | | |
1841 | | - | |
| 1842 | + | |
| 1843 | + | |
1842 | 1844 | | |
1843 | 1845 | | |
1844 | 1846 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
137 | 137 | | |
138 | 138 | | |
139 | 139 | | |
| 140 | + | |
140 | 141 | | |
141 | 142 | | |
142 | 143 | | |
| |||
18959 | 18960 | | |
18960 | 18961 | | |
18961 | 18962 | | |
| 18963 | + | |
18962 | 18964 | | |
18963 | 18965 | | |
18964 | 18966 | | |
| |||
19230 | 19232 | | |
19231 | 19233 | | |
19232 | 19234 | | |
| 19235 | + | |
| 19236 | + | |
| 19237 | + | |
| 19238 | + | |
19233 | 19239 | | |
19234 | 19240 | | |
19235 | 19241 | | |
| |||
19271 | 19277 | | |
19272 | 19278 | | |
19273 | 19279 | | |
| 19280 | + | |
| 19281 | + | |
| 19282 | + | |
| 19283 | + | |
| 19284 | + | |
| 19285 | + | |
19274 | 19286 | | |
19275 | 19287 | | |
19276 | 19288 | | |
| |||
0 commit comments