Skip to content

Commit 6b196c0

Browse files
committed
Don't print NO ACTION foreign key actions in dumps and psql \d.
1 parent 4cff59d commit 6b196c0

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

src/backend/utils/adt/ruleutils.c

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* back to source text
44
*
55
* IDENTIFICATION
6-
* $Header: /cvsroot/pgsql/src/backend/utils/adt/ruleutils.c,v 1.132 2003/01/10 21:08:15 tgl Exp $
6+
* $Header: /cvsroot/pgsql/src/backend/utils/adt/ruleutils.c,v 1.133 2003/02/03 15:17:24 momjian Exp $
77
*
88
* This software is copyrighted by Jan Wieck - Hamburg.
99
*
@@ -642,7 +642,7 @@ pg_get_constraintdef(PG_FUNCTION_ARGS)
642642
switch (conForm->confupdtype)
643643
{
644644
case FKCONSTR_ACTION_NOACTION:
645-
string = "NO ACTION";
645+
string = "";
646646
break;
647647
case FKCONSTR_ACTION_RESTRICT:
648648
string = "RESTRICT";
@@ -662,12 +662,13 @@ pg_get_constraintdef(PG_FUNCTION_ARGS)
662662
string = ""; /* keep compiler quiet */
663663
break;
664664
}
665-
appendStringInfo(&buf, " ON UPDATE %s", string);
665+
if (strlen(string) != 0)
666+
appendStringInfo(&buf, " ON UPDATE %s", string);
666667

667668
switch (conForm->confdeltype)
668669
{
669670
case FKCONSTR_ACTION_NOACTION:
670-
string = "NO ACTION";
671+
string = "";
671672
break;
672673
case FKCONSTR_ACTION_RESTRICT:
673674
string = "RESTRICT";
@@ -687,7 +688,8 @@ pg_get_constraintdef(PG_FUNCTION_ARGS)
687688
string = ""; /* keep compiler quiet */
688689
break;
689690
}
690-
appendStringInfo(&buf, " ON DELETE %s", string);
691+
if (strlen(string) != 0)
692+
appendStringInfo(&buf, " ON DELETE %s", string);
691693

692694
if (conForm->condeferrable)
693695
appendStringInfo(&buf, " DEFERRABLE");

0 commit comments

Comments
 (0)