aboutsummaryrefslogtreecommitdiff
path: root/src/backend/utils/adt/ruleutils.c
diff options
context:
space:
mode:
authorAlvaro Herrera <alvherre@alvh.no-ip.org>2011-06-02 12:39:53 -0400
committerAlvaro Herrera <alvherre@alvh.no-ip.org>2011-06-03 16:05:34 -0400
commit048417511aef8d5fb2d541b17b73afc730935cd5 (patch)
treec73d54b9b74474fdd91e71162dcb0b3833ba847c /src/backend/utils/adt/ruleutils.c
parentea8e42f3a0848f506d8a1b9c74967248005291cd (diff)
downloadpostgresql-048417511aef8d5fb2d541b17b73afc730935cd5.tar.gz
postgresql-048417511aef8d5fb2d541b17b73afc730935cd5.zip
Fix pg_get_constraintdef to cope with NOT VALID constraints
This case was missed when NOT VALID constraints were first introduced in commit 722bf7017bbe796decc79c1fde03e7a83dae9ada by Simon Riggs on 2011-02-08. Among other things, it causes pg_dump to omit the NOT VALID flag when dumping such constraints, which may cause them to fail to load afterwards, if they contained values failing the constraint. Per report from Thom Brown.
Diffstat (limited to 'src/backend/utils/adt/ruleutils.c')
-rw-r--r--src/backend/utils/adt/ruleutils.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/backend/utils/adt/ruleutils.c b/src/backend/utils/adt/ruleutils.c
index 1595ef032d1..a67f7986a14 100644
--- a/src/backend/utils/adt/ruleutils.c
+++ b/src/backend/utils/adt/ruleutils.c
@@ -1373,6 +1373,9 @@ pg_get_constraintdef_worker(Oid constraintId, bool fullCommand,
if (conForm->condeferred)
appendStringInfo(&buf, " INITIALLY DEFERRED");
+ if (!conForm->convalidated)
+ appendStringInfoString(&buf, " NOT VALID");
+
/* Cleanup */
ReleaseSysCache(tup);