Skip to content

Commit 6ee2a3b

Browse files
committed
Fix pg_dump to not crash if -t or a similar switch is used to select a serial
sequence for dumping without also selecting its owning table. Make it not try to emit ALTER SEQUENCE OWNED BY in this situation. Per report from Michael Nolan.
1 parent de9effb commit 6ee2a3b

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/bin/pg_dump/pg_dump.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
* by PostgreSQL
1313
*
1414
* IDENTIFICATION
15-
* $PostgreSQL: pgsql/src/bin/pg_dump/pg_dump.c,v 1.466 2007/04/02 03:49:39 tgl Exp $
15+
* $PostgreSQL: pgsql/src/bin/pg_dump/pg_dump.c,v 1.467 2007/04/16 18:42:10 tgl Exp $
1616
*
1717
*-------------------------------------------------------------------------
1818
*/
@@ -8654,8 +8654,8 @@ dumpSequence(Archive *fout, TableInfo *tbinfo)
86548654
*
86558655
* Add a CREATE SEQUENCE statement as part of a "schema" dump (use
86568656
* last_val for start if called is false, else use min_val for start_val).
8657-
* Also, if the sequence is owned by a column, add an ALTER SEQUENCE SET
8658-
* OWNED command for it.
8657+
* Also, if the sequence is owned by a column, add an ALTER SEQUENCE
8658+
* OWNED BY command for it.
86598659
*
86608660
* Add a 'SETVAL(seq, last_val, iscalled)' as part of a "data" dump.
86618661
*/
@@ -8723,7 +8723,7 @@ dumpSequence(Archive *fout, TableInfo *tbinfo)
87238723
{
87248724
TableInfo *owning_tab = findTableByOid(tbinfo->owning_tab);
87258725

8726-
if (owning_tab)
8726+
if (owning_tab && owning_tab->dobj.dump)
87278727
{
87288728
resetPQExpBuffer(query);
87298729
appendPQExpBuffer(query, "ALTER SEQUENCE %s",

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy