aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2007-04-16 18:42:17 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2007-04-16 18:42:17 +0000
commitaeb54176335c72f070d6614fb12e0c96b8ba88da (patch)
tree36e7f83479bd7f351e7445d74bf9e0ce85ea609c
parent366e9eea24810d8f7c038e9b5b268f56e4a1faef (diff)
downloadpostgresql-aeb54176335c72f070d6614fb12e0c96b8ba88da.tar.gz
postgresql-aeb54176335c72f070d6614fb12e0c96b8ba88da.zip
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 c4df03083e1..ad695d2df1d 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.453 2006/10/09 23:36:59 tgl Exp $
+ * $PostgreSQL: pgsql/src/bin/pg_dump/pg_dump.c,v 1.453.2.1 2007/04/16 18:42:17 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -8030,8 +8030,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.
*/
@@ -8099,7 +8099,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",