From 659b81fcd12093dcf71ab0119adb4465c580cf83 Mon Sep 17 00:00:00 2001
From: Alvaro Herrera <alvherre@alvh.no-ip.org>
Date: Thu, 2 Jun 2011 12:39:53 -0400
Subject: [PATCH] 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.
---
 src/backend/utils/adt/ruleutils.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/src/backend/utils/adt/ruleutils.c b/src/backend/utils/adt/ruleutils.c
index 1595ef0..a67f798 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);
 
-- 
1.7.4.4

