summaryrefslogtreecommitdiff
path: root/src/bin
diff options
context:
space:
mode:
Diffstat (limited to 'src/bin')
-rw-r--r--src/bin/pg_dump/pg_dump.c8
-rw-r--r--src/bin/pg_dump/pg_dump_sort.c3
2 files changed, 7 insertions, 4 deletions
diff --git a/src/bin/pg_dump/pg_dump.c b/src/bin/pg_dump/pg_dump.c
index 890db7b08c2..4b8cd49df09 100644
--- a/src/bin/pg_dump/pg_dump.c
+++ b/src/bin/pg_dump/pg_dump.c
@@ -9351,8 +9351,7 @@ getTableAttrs(Archive *fout, TableInfo *tblinfo, int numTables)
*
* We track in notnull_islocal whether the constraint was defined directly
* in this table or via an ancestor, for binary upgrade. flagInhAttrs
- * might modify this later; that routine is also in charge of determining
- * the correct inhcount.
+ * might modify this later.
*/
if (fout->remoteVersion >= 180000)
appendPQExpBufferStr(q,
@@ -9369,7 +9368,10 @@ getTableAttrs(Archive *fout, TableInfo *tblinfo, int numTables)
"NULL AS notnull_comment,\n"
"NULL AS notnull_invalidoid,\n"
"false AS notnull_noinherit,\n"
- "a.attislocal AS notnull_islocal,\n");
+ "CASE WHEN a.attislocal THEN true\n"
+ " WHEN a.attnotnull AND NOT a.attislocal THEN true\n"
+ " ELSE false\n"
+ "END AS notnull_islocal,\n");
if (fout->remoteVersion >= 140000)
appendPQExpBufferStr(q,
diff --git a/src/bin/pg_dump/pg_dump_sort.c b/src/bin/pg_dump/pg_dump_sort.c
index 2d02456664b..164c76e0864 100644
--- a/src/bin/pg_dump/pg_dump_sort.c
+++ b/src/bin/pg_dump/pg_dump_sort.c
@@ -385,7 +385,8 @@ DOTypeNameCompare(const void *p1, const void *p2)
if (cmpval != 0)
return cmpval;
}
- else if (obj1->objType == DO_CONSTRAINT)
+ else if (obj1->objType == DO_CONSTRAINT ||
+ obj1->objType == DO_FK_CONSTRAINT)
{
ConstraintInfo *robj1 = *(ConstraintInfo *const *) p1;
ConstraintInfo *robj2 = *(ConstraintInfo *const *) p2;