Don't print NO ACTION foreign key actions in dumps and psql \d.

This commit is contained in:
Bruce Momjian 2003-02-03 15:17:24 +00:00
parent 4cff59d8d5
commit 6b196c0754
1 changed files with 7 additions and 5 deletions

View File

@ -3,7 +3,7 @@
* back to source text * back to source text
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/adt/ruleutils.c,v 1.132 2003/01/10 21:08:15 tgl Exp $ * $Header: /cvsroot/pgsql/src/backend/utils/adt/ruleutils.c,v 1.133 2003/02/03 15:17:24 momjian Exp $
* *
* This software is copyrighted by Jan Wieck - Hamburg. * This software is copyrighted by Jan Wieck - Hamburg.
* *
@ -642,7 +642,7 @@ pg_get_constraintdef(PG_FUNCTION_ARGS)
switch (conForm->confupdtype) switch (conForm->confupdtype)
{ {
case FKCONSTR_ACTION_NOACTION: case FKCONSTR_ACTION_NOACTION:
string = "NO ACTION"; string = "";
break; break;
case FKCONSTR_ACTION_RESTRICT: case FKCONSTR_ACTION_RESTRICT:
string = "RESTRICT"; string = "RESTRICT";
@ -662,12 +662,13 @@ pg_get_constraintdef(PG_FUNCTION_ARGS)
string = ""; /* keep compiler quiet */ string = ""; /* keep compiler quiet */
break; break;
} }
appendStringInfo(&buf, " ON UPDATE %s", string); if (strlen(string) != 0)
appendStringInfo(&buf, " ON UPDATE %s", string);
switch (conForm->confdeltype) switch (conForm->confdeltype)
{ {
case FKCONSTR_ACTION_NOACTION: case FKCONSTR_ACTION_NOACTION:
string = "NO ACTION"; string = "";
break; break;
case FKCONSTR_ACTION_RESTRICT: case FKCONSTR_ACTION_RESTRICT:
string = "RESTRICT"; string = "RESTRICT";
@ -687,7 +688,8 @@ pg_get_constraintdef(PG_FUNCTION_ARGS)
string = ""; /* keep compiler quiet */ string = ""; /* keep compiler quiet */
break; break;
} }
appendStringInfo(&buf, " ON DELETE %s", string); if (strlen(string) != 0)
appendStringInfo(&buf, " ON DELETE %s", string);
if (conForm->condeferrable) if (conForm->condeferrable)
appendStringInfo(&buf, " DEFERRABLE"); appendStringInfo(&buf, " DEFERRABLE");