]> granicus.if.org Git - postgresql/commitdiff
Fix dumping of DEFERRABLE/INITIALLY DEFERRED:
authorBruce Momjian <bruce@momjian.us>
Wed, 8 Jan 2003 22:54:06 +0000 (22:54 +0000)
committerBruce Momjian <bruce@momjian.us>
Wed, 8 Jan 2003 22:54:06 +0000 (22:54 +0000)
> The big problem is that while pg_dump's dump_trigger() looks at
> tginitdeferred and dumps accordingly, pg_get_constraintdef doesn't look
> at tginitdeferred, and therefore doesn't record the requirement as part
> of ALTER TABLE ADD CONSTRAINT.

pg_get_constraintdef should probably be looking at condeferrable and
condeferred in the pg_constraint row it's looking at.  Maybe something
like the attached.

(Added, output only non-default values.)

Stephan Szabo

src/backend/utils/adt/ruleutils.c

index 2fecab9655c277a8400aa43b4da3a35a1cc6504c..0275d8424acc86ce8d75b5f5e46a74847eb64d08 100644 (file)
@@ -3,7 +3,7 @@
  *                             back to source text
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/utils/adt/ruleutils.c,v 1.129 2002/12/14 00:17:59 tgl Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/utils/adt/ruleutils.c,v 1.130 2003/01/08 22:54:06 momjian Exp $
  *
  *       This software is copyrighted by Jan Wieck - Hamburg.
  *
@@ -688,6 +688,11 @@ pg_get_constraintdef(PG_FUNCTION_ARGS)
                                }
                                appendStringInfo(&buf, " ON DELETE %s", string);
 
+                               if (conForm->condeferrable)
+                                       appendStringInfo(&buf, " DEFERRABLE");
+                               if (conForm->condeferred)
+                                       appendStringInfo(&buf, " INITIALLY DEFERRED");
+
                                break;
                        }