Commit 8bfc4373 authored by Tom Lane's avatar Tom Lane

Clean up a bunch of ScanKeyEntryInitialize calls that weren't bothering

to apply the proper Datum conversion macros to search key values.
parent 801a1acc
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * 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 * INTERFACE ROUTINES
...@@ -438,7 +438,7 @@ RelnameFindRelid(const char *relname) ...@@ -438,7 +438,7 @@ RelnameFindRelid(const char *relname)
0, 0,
(AttrNumber) Anum_pg_class_relname, (AttrNumber) Anum_pg_class_relname,
(RegProcedure) F_NAMEEQ, (RegProcedure) F_NAMEEQ,
(Datum) relname); PointerGetDatum(relname));
/* /*
* begin the scan * begin the scan
...@@ -1200,7 +1200,7 @@ DeleteTypeTuple(Relation rel) ...@@ -1200,7 +1200,7 @@ DeleteTypeTuple(Relation rel)
0, 0,
Anum_pg_attribute_atttypid, Anum_pg_attribute_atttypid,
F_OIDEQ, F_OIDEQ,
typoid); ObjectIdGetDatum(typoid));
pg_attribute_scan = heap_beginscan(pg_attribute_desc, pg_attribute_scan = heap_beginscan(pg_attribute_desc,
0, 0,
...@@ -1883,7 +1883,8 @@ RemoveAttrDefault(Relation rel) ...@@ -1883,7 +1883,8 @@ RemoveAttrDefault(Relation rel)
adrel = heap_openr(AttrDefaultRelationName, RowExclusiveLock); adrel = heap_openr(AttrDefaultRelationName, RowExclusiveLock);
ScanKeyEntryInitialize(&key, 0, Anum_pg_attrdef_adrelid, ScanKeyEntryInitialize(&key, 0, Anum_pg_attrdef_adrelid,
F_OIDEQ, RelationGetRelid(rel)); F_OIDEQ,
ObjectIdGetDatum(RelationGetRelid(rel)));
adscan = heap_beginscan(adrel, 0, SnapshotNow, 1, &key); adscan = heap_beginscan(adrel, 0, SnapshotNow, 1, &key);
...@@ -1905,7 +1906,8 @@ RemoveRelCheck(Relation rel) ...@@ -1905,7 +1906,8 @@ RemoveRelCheck(Relation rel)
rcrel = heap_openr(RelCheckRelationName, RowExclusiveLock); rcrel = heap_openr(RelCheckRelationName, RowExclusiveLock);
ScanKeyEntryInitialize(&key, 0, Anum_pg_relcheck_rcrelid, ScanKeyEntryInitialize(&key, 0, Anum_pg_relcheck_rcrelid,
F_OIDEQ, RelationGetRelid(rel)); F_OIDEQ,
ObjectIdGetDatum(RelationGetRelid(rel)));
rcscan = heap_beginscan(rcrel, 0, SnapshotNow, 1, &key); rcscan = heap_beginscan(rcrel, 0, SnapshotNow, 1, &key);
...@@ -1983,10 +1985,12 @@ RemoveCheckConstraint(Relation rel, const char *constrName, bool inh) ...@@ -1983,10 +1985,12 @@ RemoveCheckConstraint(Relation rel, const char *constrName, bool inh)
* constraint. * constraint.
*/ */
ScanKeyEntryInitialize(&key[0], 0, Anum_pg_relcheck_rcrelid, 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, ScanKeyEntryInitialize(&key[1], 0, Anum_pg_relcheck_rcname,
F_NAMEEQ, PointerGetDatum(constrName)); F_NAMEEQ,
PointerGetDatum(constrName));
/* Begin scanning the heap */ /* Begin scanning the heap */
rcscan = heap_beginscan(rcrel, 0, SnapshotNow, 2, key); rcscan = heap_beginscan(rcrel, 0, SnapshotNow, 2, key);
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* Portions Copyright (c) 1994, Regents of the University of California * Portions Copyright (c) 1994, Regents of the University of California
* *
* IDENTIFICATION * 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) ...@@ -145,7 +145,8 @@ CreateTrigger(CreateTrigStmt *stmt)
*/ */
tgrel = heap_openr(TriggerRelationName, RowExclusiveLock); tgrel = heap_openr(TriggerRelationName, RowExclusiveLock);
ScanKeyEntryInitialize(&key, 0, Anum_pg_trigger_tgrelid, ScanKeyEntryInitialize(&key, 0, Anum_pg_trigger_tgrelid,
F_OIDEQ, RelationGetRelid(rel)); F_OIDEQ,
ObjectIdGetDatum(RelationGetRelid(rel)));
tgscan = heap_beginscan(tgrel, 0, SnapshotNow, 1, &key); tgscan = heap_beginscan(tgrel, 0, SnapshotNow, 1, &key);
while (HeapTupleIsValid(tuple = heap_getnext(tgscan, 0))) while (HeapTupleIsValid(tuple = heap_getnext(tgscan, 0)))
{ {
...@@ -327,7 +328,8 @@ DropTrigger(DropTrigStmt *stmt) ...@@ -327,7 +328,8 @@ DropTrigger(DropTrigStmt *stmt)
*/ */
tgrel = heap_openr(TriggerRelationName, RowExclusiveLock); tgrel = heap_openr(TriggerRelationName, RowExclusiveLock);
ScanKeyEntryInitialize(&key, 0, Anum_pg_trigger_tgrelid, ScanKeyEntryInitialize(&key, 0, Anum_pg_trigger_tgrelid,
F_OIDEQ, RelationGetRelid(rel)); F_OIDEQ,
ObjectIdGetDatum(RelationGetRelid(rel)));
tgscan = heap_beginscan(tgrel, 0, SnapshotNow, 1, &key); tgscan = heap_beginscan(tgrel, 0, SnapshotNow, 1, &key);
while (HeapTupleIsValid(tuple = heap_getnext(tgscan, 0))) while (HeapTupleIsValid(tuple = heap_getnext(tgscan, 0)))
{ {
...@@ -398,7 +400,8 @@ RelationRemoveTriggers(Relation rel) ...@@ -398,7 +400,8 @@ RelationRemoveTriggers(Relation rel)
tgrel = heap_openr(TriggerRelationName, RowExclusiveLock); tgrel = heap_openr(TriggerRelationName, RowExclusiveLock);
ScanKeyEntryInitialize(&key, 0, Anum_pg_trigger_tgrelid, ScanKeyEntryInitialize(&key, 0, Anum_pg_trigger_tgrelid,
F_OIDEQ, RelationGetRelid(rel)); F_OIDEQ,
ObjectIdGetDatum(RelationGetRelid(rel)));
tgscan = heap_beginscan(tgrel, 0, SnapshotNow, 1, &key); tgscan = heap_beginscan(tgrel, 0, SnapshotNow, 1, &key);
...@@ -450,7 +453,8 @@ RelationRemoveTriggers(Relation rel) ...@@ -450,7 +453,8 @@ RelationRemoveTriggers(Relation rel)
* Also drop all constraint triggers referencing this relation * Also drop all constraint triggers referencing this relation
*/ */
ScanKeyEntryInitialize(&key, 0, Anum_pg_trigger_tgconstrrelid, ScanKeyEntryInitialize(&key, 0, Anum_pg_trigger_tgconstrrelid,
F_OIDEQ, RelationGetRelid(rel)); F_OIDEQ,
ObjectIdGetDatum(RelationGetRelid(rel)));
tgscan = heap_beginscan(tgrel, 0, SnapshotNow, 1, &key); tgscan = heap_beginscan(tgrel, 0, SnapshotNow, 1, &key);
while (HeapTupleIsValid(tup = heap_getnext(tgscan, 0))) while (HeapTupleIsValid(tup = heap_getnext(tgscan, 0)))
...@@ -585,12 +589,6 @@ RelationBuildTriggers(Relation relation) ...@@ -585,12 +589,6 @@ RelationBuildTriggers(Relation relation)
build->tgnargs = pg_trigger->tgnargs; build->tgnargs = pg_trigger->tgnargs;
memcpy(build->tgattr, &(pg_trigger->tgattr), memcpy(build->tgattr, &(pg_trigger->tgattr),
FUNC_MAX_ARGS * sizeof(int16)); 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) if (build->tgnargs > 0)
{ {
char *p; char *p;
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * 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) ...@@ -695,7 +695,7 @@ func_get_candidates(char *funcname, int nargs)
(bits16) 0x0, (bits16) 0x0,
(AttrNumber) Anum_pg_proc_proname, (AttrNumber) Anum_pg_proc_proname,
(RegProcedure) F_NAMEEQ, (RegProcedure) F_NAMEEQ,
(Datum) funcname); PointerGetDatum(funcname));
idesc = index_openr(ProcedureNameIndex); idesc = index_openr(ProcedureNameIndex);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment