summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2007-04-16 18:42:10 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2007-04-16 18:42:10 +0000
commit6ee2a3be4ab1a87fb0a02876c19bf130ca5d2129 (patch)
treef4ea49ff9a54d92f8eaafb26803d25b3e1f88c8e
parentde9effb55f549e2d7e558c3e5d49bfdb6ee775a3 (diff)
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.
-rw-r--r--src/bin/pg_dump/pg_dump.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/bin/pg_dump/pg_dump.c b/src/bin/pg_dump/pg_dump.c
index 9f9790baed1..65595062634 100644
--- a/src/bin/pg_dump/pg_dump.c
+++ b/src/bin/pg_dump/pg_dump.c
@@ -12,7 +12,7 @@
* by PostgreSQL
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/bin/pg_dump/pg_dump.c,v 1.466 2007/04/02 03:49:39 tgl Exp $
+ * $PostgreSQL: pgsql/src/bin/pg_dump/pg_dump.c,v 1.467 2007/04/16 18:42:10 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -8654,8 +8654,8 @@ dumpSequence(Archive *fout, TableInfo *tbinfo)
*
* Add a CREATE SEQUENCE statement as part of a "schema" dump (use
* last_val for start if called is false, else use min_val for start_val).
- * Also, if the sequence is owned by a column, add an ALTER SEQUENCE SET
- * OWNED command for it.
+ * Also, if the sequence is owned by a column, add an ALTER SEQUENCE
+ * OWNED BY command for it.
*
* Add a 'SETVAL(seq, last_val, iscalled)' as part of a "data" dump.
*/
@@ -8723,7 +8723,7 @@ dumpSequence(Archive *fout, TableInfo *tbinfo)
{
TableInfo *owning_tab = findTableByOid(tbinfo->owning_tab);
- if (owning_tab)
+ if (owning_tab && owning_tab->dobj.dump)
{
resetPQExpBuffer(query);
appendPQExpBuffer(query, "ALTER SEQUENCE %s",