diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2010-01-17 22:56:23 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2010-01-17 22:56:23 +0000 |
commit | 9a915e596f38a97f10e00d388f18e178136937eb (patch) | |
tree | c0f85775a2423e0fb28c4d96d85569781668011e /src/include/commands/trigger.h | |
parent | ee3b4188a78916544ef30e93fc1c9e5e780e07d5 (diff) | |
download | postgresql-9a915e596f38a97f10e00d388f18e178136937eb.tar.gz postgresql-9a915e596f38a97f10e00d388f18e178136937eb.zip |
Improve the handling of SET CONSTRAINTS commands by having them search
pg_constraint before searching pg_trigger. This allows saner handling of
corner cases; in particular we now say "constraint is not deferrable"
rather than "constraint does not exist" when the command is applied to
a constraint that's inherently non-deferrable. Per a gripe several months
ago from hubert depesz lubaczewski.
To make this work without breaking user-defined constraint triggers,
we have to add entries for them to pg_constraint. However, in return
we can remove the pgconstrname column from pg_constraint, which represents
a fairly sizable space savings. I also replaced the tgisconstraint column
with tgisinternal; the old meaning of tgisconstraint can now be had by
testing for nonzero tgconstraint, while there is no other way to get
the old meaning of nonzero tgconstraint, namely that the trigger was
internally generated rather than being user-created.
In passing, fix an old misstatement in the docs and comments, namely that
pg_trigger.tgdeferrable is exactly redundant with pg_constraint.condeferrable.
Actually, we mark RI action triggers as nondeferrable even when they belong to
a nominally deferrable FK constraint. The SET CONSTRAINTS code now relies on
that instead of hard-coding a list of exception OIDs.
Diffstat (limited to 'src/include/commands/trigger.h')
-rw-r--r-- | src/include/commands/trigger.h | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/include/commands/trigger.h b/src/include/commands/trigger.h index b5f44bb33e1..db79eb4be73 100644 --- a/src/include/commands/trigger.h +++ b/src/include/commands/trigger.h @@ -6,7 +6,7 @@ * Portions Copyright (c) 1996-2010, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/commands/trigger.h,v 1.79 2010/01/02 16:58:03 momjian Exp $ + * $PostgreSQL: pgsql/src/include/commands/trigger.h,v 1.80 2010/01/17 22:56:23 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -105,8 +105,8 @@ extern PGDLLIMPORT int SessionReplicationRole; #define TRIGGER_DISABLED 'D' extern Oid CreateTrigger(CreateTrigStmt *stmt, const char *queryString, - Oid constraintOid, Oid indexOid, const char *prefix, - bool checkPermissions); + Oid constraintOid, Oid indexOid, + bool isInternal); extern void DropTrigger(Oid relid, const char *trigname, DropBehavior behavior, bool missing_ok); |