diff options
author | Bruce Momjian <bruce@momjian.us> | 2002-07-20 05:16:59 +0000 |
---|---|---|
committer | Bruce Momjian <bruce@momjian.us> | 2002-07-20 05:16:59 +0000 |
commit | b0f5086e4133d1d8ec092799952dda65ebd717c8 (patch) | |
tree | 0f717342af7cce7896d40fdb34ccc572e435d499 /src/backend/commands/trigger.c | |
parent | 38dd3ae7d032eecc6ddadcbd402d90f6ac38f6a3 (diff) | |
download | postgresql-b0f5086e4133d1d8ec092799952dda65ebd717c8.tar.gz postgresql-b0f5086e4133d1d8ec092799952dda65ebd717c8.zip |
oid is needed, it is added at the end of the struct (after the null
bitmap, if present).
Per Tom Lane's suggestion the information whether a tuple has an oid
or not is carried in the tuple descriptor. For debugging reasons
tdhasoid is of type char, not bool. There are predefined values for
WITHOID, WITHOUTOID and UNDEFOID.
This patch has been generated against a cvs snapshot from last week
and I don't expect it to apply cleanly to current sources. While I
post it here for public review, I'm working on a new version against a
current snapshot. (There's been heavy activity recently; hope to
catch up some day ...)
This is a long patch; if it is too hard to swallow, I can provide it
in smaller pieces:
Part 1: Accessor macros
Part 2: tdhasoid in TupDesc
Part 3: Regression test
Part 4: Parameter withoid to heap_addheader
Part 5: Eliminate t_oid from HeapTupleHeader
Part 2 is the most hairy part because of changes in the executor and
even in the parser; the other parts are straightforward.
Up to part 4 the patched postmaster stays binary compatible to
databases created with an unpatched version. Part 5 is small (100
lines) and finally breaks compatibility.
Manfred Koizar
Diffstat (limited to 'src/backend/commands/trigger.c')
-rw-r--r-- | src/backend/commands/trigger.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/backend/commands/trigger.c b/src/backend/commands/trigger.c index b27dd0f4380..4c2ee626fe0 100644 --- a/src/backend/commands/trigger.c +++ b/src/backend/commands/trigger.c @@ -7,7 +7,7 @@ * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/commands/trigger.c,v 1.121 2002/07/12 18:43:16 tgl Exp $ + * $Header: /cvsroot/pgsql/src/backend/commands/trigger.c,v 1.122 2002/07/20 05:16:57 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -400,8 +400,9 @@ DropTrigger(Oid relid, const char *trigname, DropBehavior behavior) if (!pg_class_ownercheck(relid, GetUserId())) aclcheck_error(ACLCHECK_NOT_OWNER, get_rel_name(relid)); + AssertTupleDescHasOid(tgrel->rd_att); object.classId = RelationGetRelid(tgrel); - object.objectId = tup->t_data->t_oid; + object.objectId = HeapTupleGetOid(tup); object.objectSubId = 0; systable_endscan(tgscan); @@ -671,7 +672,8 @@ RelationBuildTriggers(Relation relation) RelationGetRelationName(relation)); build = &(triggers[found]); - build->tgoid = htup->t_data->t_oid; + AssertTupleDescHasOid(tgrel->rd_att); + build->tgoid = HeapTupleGetOid(htup); build->tgname = MemoryContextStrdup(CacheMemoryContext, DatumGetCString(DirectFunctionCall1(nameout, NameGetDatum(&pg_trigger->tgname)))); @@ -1932,7 +1934,8 @@ DeferredTriggerSetState(ConstraintsSetStmt *stmt) elog(ERROR, "Constraint '%s' is not deferrable", cname); - constr_oid = htup->t_data->t_oid; + AssertTupleDescHasOid(tgrel->rd_att); + constr_oid = HeapTupleGetOid(htup); loid = lappendi(loid, constr_oid); found = true; } |