Skip to content

Commit 80bc61c

Browse files
committed
Ensure that FK constraints are dumped after primary/unique constraints,
rather than relying on OID order of pg_constraint entries. Per gripe from Greg Stark.
1 parent ce2ab41 commit 80bc61c

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/bin/pg_dump/pg_dump.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
* by PostgreSQL
1313
*
1414
* IDENTIFICATION
15-
* $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_dump.c,v 1.344 2003/08/08 01:21:02 momjian Exp $
15+
* $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_dump.c,v 1.345 2003/08/28 18:59:06 tgl Exp $
1616
*
1717
*-------------------------------------------------------------------------
1818
*/
@@ -588,6 +588,7 @@ main(int argc, char **argv)
588588
MoveToEnd(g_fout, "BLOBS");
589589
MoveToEnd(g_fout, "INDEX");
590590
MoveToEnd(g_fout, "CONSTRAINT");
591+
MoveToEnd(g_fout, "FK CONSTRAINT");
591592
MoveToEnd(g_fout, "TRIGGER");
592593
MoveToEnd(g_fout, "RULE");
593594
MoveToEnd(g_fout, "SEQUENCE SET");
@@ -6039,6 +6040,8 @@ dumpOneSequence(Archive *fout, TableInfo *tbinfo,
60396040
*
60406041
* Dump out constraints after all table creation statements in
60416042
* an alter table format. Currently handles foreign keys only.
6043+
* (Unique and primary key constraints are handled with indexes,
6044+
* while check constraints are merged into the table definition.)
60426045
*
60436046
* XXX Potentially wrap in a 'SET CONSTRAINTS OFF' block so that
60446047
* the current table data is not processed
@@ -6130,7 +6133,7 @@ dumpConstraints(Archive *fout, TableInfo *tblinfo, int numTables)
61306133
conName,
61316134
tbinfo->relnamespace->nspname,
61326135
tbinfo->usename,
6133-
"CONSTRAINT", NULL,
6136+
"FK CONSTRAINT", NULL,
61346137
query->data, delqry->data,
61356138
NULL, NULL, NULL);
61366139

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