Fix display and dumping of UPDATE OR TRUNCATE triggers (a bizarre combination

maybe, but we should get it right).  Bug noted while reviewing TRIGGER WHEN
patch.  Already fixed in HEAD.
This commit is contained in:
Tom Lane 2009-11-20 20:54:20 +00:00
parent cd5c42de59
commit 00d144ddab
2 changed files with 6 additions and 2 deletions

View File

@ -9,7 +9,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/utils/adt/ruleutils.c,v 1.300 2009/06/11 14:49:04 momjian Exp $
* $PostgreSQL: pgsql/src/backend/utils/adt/ruleutils.c,v 1.300.2.1 2009/11/20 20:54:20 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@ -525,6 +525,7 @@ pg_get_triggerdef(PG_FUNCTION_ARGS)
appendStringInfo(&buf, " OR UPDATE");
else
appendStringInfo(&buf, " UPDATE");
findx++;
}
if (TRIGGER_FOR_TRUNCATE(trigrec->tgtype))
{
@ -532,6 +533,7 @@ pg_get_triggerdef(PG_FUNCTION_ARGS)
appendStringInfo(&buf, " OR TRUNCATE");
else
appendStringInfo(&buf, " TRUNCATE");
findx++;
}
appendStringInfo(&buf, " ON %s ",
generate_relation_name(trigrec->tgrelid, NIL));

View File

@ -12,7 +12,7 @@
* by PostgreSQL
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/bin/pg_dump/pg_dump.c,v 1.539.2.2 2009/07/20 20:53:47 momjian Exp $
* $PostgreSQL: pgsql/src/bin/pg_dump/pg_dump.c,v 1.539.2.3 2009/11/20 20:54:20 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@ -10885,6 +10885,7 @@ dumpTrigger(Archive *fout, TriggerInfo *tginfo)
appendPQExpBuffer(query, " OR UPDATE");
else
appendPQExpBuffer(query, " UPDATE");
findx++;
}
if (TRIGGER_FOR_TRUNCATE(tginfo->tgtype))
{
@ -10892,6 +10893,7 @@ dumpTrigger(Archive *fout, TriggerInfo *tginfo)
appendPQExpBuffer(query, " OR TRUNCATE");
else
appendPQExpBuffer(query, " TRUNCATE");
findx++;
}
appendPQExpBuffer(query, " ON %s\n",
fmtId(tbinfo->dobj.name));