From 8bfc437301d5ac1a209349b4c9e466b798e5b90a Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Mon, 12 Nov 2001 00:00:55 +0000 Subject: [PATCH] Clean up a bunch of ScanKeyEntryInitialize calls that weren't bothering to apply the proper Datum conversion macros to search key values. --- src/backend/catalog/heap.c | 18 +++++++++++------- src/backend/commands/trigger.c | 20 +++++++++----------- src/backend/parser/parse_func.c | 4 ++-- 3 files changed, 22 insertions(+), 20 deletions(-) diff --git a/src/backend/catalog/heap.c b/src/backend/catalog/heap.c index f0ec85a7f8..809702ddec 100644 --- a/src/backend/catalog/heap.c +++ b/src/backend/catalog/heap.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/catalog/heap.c,v 1.180 2001/11/02 20:23:02 tgl Exp $ + * $Header: /cvsroot/pgsql/src/backend/catalog/heap.c,v 1.181 2001/11/12 00:00:55 tgl Exp $ * * * INTERFACE ROUTINES @@ -438,7 +438,7 @@ RelnameFindRelid(const char *relname) 0, (AttrNumber) Anum_pg_class_relname, (RegProcedure) F_NAMEEQ, - (Datum) relname); + PointerGetDatum(relname)); /* * begin the scan @@ -1200,7 +1200,7 @@ DeleteTypeTuple(Relation rel) 0, Anum_pg_attribute_atttypid, F_OIDEQ, - typoid); + ObjectIdGetDatum(typoid)); pg_attribute_scan = heap_beginscan(pg_attribute_desc, 0, @@ -1883,7 +1883,8 @@ RemoveAttrDefault(Relation rel) adrel = heap_openr(AttrDefaultRelationName, RowExclusiveLock); ScanKeyEntryInitialize(&key, 0, Anum_pg_attrdef_adrelid, - F_OIDEQ, RelationGetRelid(rel)); + F_OIDEQ, + ObjectIdGetDatum(RelationGetRelid(rel))); adscan = heap_beginscan(adrel, 0, SnapshotNow, 1, &key); @@ -1905,7 +1906,8 @@ RemoveRelCheck(Relation rel) rcrel = heap_openr(RelCheckRelationName, RowExclusiveLock); ScanKeyEntryInitialize(&key, 0, Anum_pg_relcheck_rcrelid, - F_OIDEQ, RelationGetRelid(rel)); + F_OIDEQ, + ObjectIdGetDatum(RelationGetRelid(rel))); rcscan = heap_beginscan(rcrel, 0, SnapshotNow, 1, &key); @@ -1983,10 +1985,12 @@ RemoveCheckConstraint(Relation rel, const char *constrName, bool inh) * constraint. */ ScanKeyEntryInitialize(&key[0], 0, Anum_pg_relcheck_rcrelid, - F_OIDEQ, RelationGetRelid(rel)); + F_OIDEQ, + ObjectIdGetDatum(RelationGetRelid(rel))); ScanKeyEntryInitialize(&key[1], 0, Anum_pg_relcheck_rcname, - F_NAMEEQ, PointerGetDatum(constrName)); + F_NAMEEQ, + PointerGetDatum(constrName)); /* Begin scanning the heap */ rcscan = heap_beginscan(rcrel, 0, SnapshotNow, 2, key); diff --git a/src/backend/commands/trigger.c b/src/backend/commands/trigger.c index e108840d78..3847d92e5f 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.97 2001/10/25 05:49:25 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/commands/trigger.c,v 1.98 2001/11/12 00:00:55 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -145,7 +145,8 @@ CreateTrigger(CreateTrigStmt *stmt) */ tgrel = heap_openr(TriggerRelationName, RowExclusiveLock); ScanKeyEntryInitialize(&key, 0, Anum_pg_trigger_tgrelid, - F_OIDEQ, RelationGetRelid(rel)); + F_OIDEQ, + ObjectIdGetDatum(RelationGetRelid(rel))); tgscan = heap_beginscan(tgrel, 0, SnapshotNow, 1, &key); while (HeapTupleIsValid(tuple = heap_getnext(tgscan, 0))) { @@ -327,7 +328,8 @@ DropTrigger(DropTrigStmt *stmt) */ tgrel = heap_openr(TriggerRelationName, RowExclusiveLock); ScanKeyEntryInitialize(&key, 0, Anum_pg_trigger_tgrelid, - F_OIDEQ, RelationGetRelid(rel)); + F_OIDEQ, + ObjectIdGetDatum(RelationGetRelid(rel))); tgscan = heap_beginscan(tgrel, 0, SnapshotNow, 1, &key); while (HeapTupleIsValid(tuple = heap_getnext(tgscan, 0))) { @@ -398,7 +400,8 @@ RelationRemoveTriggers(Relation rel) tgrel = heap_openr(TriggerRelationName, RowExclusiveLock); ScanKeyEntryInitialize(&key, 0, Anum_pg_trigger_tgrelid, - F_OIDEQ, RelationGetRelid(rel)); + F_OIDEQ, + ObjectIdGetDatum(RelationGetRelid(rel))); tgscan = heap_beginscan(tgrel, 0, SnapshotNow, 1, &key); @@ -450,7 +453,8 @@ RelationRemoveTriggers(Relation rel) * Also drop all constraint triggers referencing this relation */ ScanKeyEntryInitialize(&key, 0, Anum_pg_trigger_tgconstrrelid, - F_OIDEQ, RelationGetRelid(rel)); + F_OIDEQ, + ObjectIdGetDatum(RelationGetRelid(rel))); tgscan = heap_beginscan(tgrel, 0, SnapshotNow, 1, &key); while (HeapTupleIsValid(tup = heap_getnext(tgscan, 0))) @@ -585,12 +589,6 @@ RelationBuildTriggers(Relation relation) build->tgnargs = pg_trigger->tgnargs; memcpy(build->tgattr, &(pg_trigger->tgattr), FUNC_MAX_ARGS * sizeof(int16)); - val = (struct varlena *) fastgetattr(htup, - Anum_pg_trigger_tgargs, - tgrel->rd_att, &isnull); - if (isnull) - elog(ERROR, "RelationBuildTriggers: tgargs IS NULL for rel %s", - RelationGetRelationName(relation)); if (build->tgnargs > 0) { char *p; diff --git a/src/backend/parser/parse_func.c b/src/backend/parser/parse_func.c index 1f2887031e..7a594df35d 100644 --- a/src/backend/parser/parse_func.c +++ b/src/backend/parser/parse_func.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/parser/parse_func.c,v 1.113 2001/11/02 16:30:29 tgl Exp $ + * $Header: /cvsroot/pgsql/src/backend/parser/parse_func.c,v 1.114 2001/11/12 00:00:55 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -695,7 +695,7 @@ func_get_candidates(char *funcname, int nargs) (bits16) 0x0, (AttrNumber) Anum_pg_proc_proname, (RegProcedure) F_NAMEEQ, - (Datum) funcname); + PointerGetDatum(funcname)); idesc = index_openr(ProcedureNameIndex); -- 2.40.0