mirror of
https://github.com/postgres/postgres.git
synced 2025-05-05 09:19:17 +03:00
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.
This commit is contained in:
parent
366e9eea24
commit
aeb5417633
@ -12,7 +12,7 @@
|
|||||||
* by PostgreSQL
|
* by PostgreSQL
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* 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
|
* 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).
|
* 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
|
* Also, if the sequence is owned by a column, add an ALTER SEQUENCE
|
||||||
* OWNED command for it.
|
* OWNED BY command for it.
|
||||||
*
|
*
|
||||||
* Add a 'SETVAL(seq, last_val, iscalled)' as part of a "data" dump.
|
* 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);
|
TableInfo *owning_tab = findTableByOid(tbinfo->owning_tab);
|
||||||
|
|
||||||
if (owning_tab)
|
if (owning_tab && owning_tab->dobj.dump)
|
||||||
{
|
{
|
||||||
resetPQExpBuffer(query);
|
resetPQExpBuffer(query);
|
||||||
appendPQExpBuffer(query, "ALTER SEQUENCE %s",
|
appendPQExpBuffer(query, "ALTER SEQUENCE %s",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user