1
0
mirror of https://github.com/postgres/postgres.git synced 2025-06-14 18:42:34 +03:00

Add operator strategy and comparison-value datatype fields to ScanKey.

Remove the 'strategy map' code, which was a large amount of mechanism
that no longer had any use except reverse-mapping from procedure OID to
strategy number.  Passing the strategy number to the index AM in the
first place is simpler and faster.
This is a preliminary step in planned support for cross-datatype index
operations.  I'm committing it now since the ScanKeyEntryInitialize()
API change touches quite a lot of files, and I want to commit those
changes before the tree drifts under me.
This commit is contained in:
Tom Lane
2003-11-09 21:30:38 +00:00
parent 723825afeb
commit c1d62bfd00
72 changed files with 950 additions and 2147 deletions

View File

@ -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.160 2003/11/06 22:08:14 petere Exp $
* $Header: /cvsroot/pgsql/src/backend/commands/trigger.c,v 1.161 2003/11/09 21:30:36 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@ -255,8 +255,8 @@ CreateTrigger(CreateTrigStmt *stmt, bool forConstraint)
tgrel = heap_openr(TriggerRelationName, RowExclusiveLock);
ScanKeyEntryInitialize(&key, 0,
Anum_pg_trigger_tgrelid,
F_OIDEQ,
ObjectIdGetDatum(RelationGetRelid(rel)));
BTEqualStrategyNumber, F_OIDEQ,
ObjectIdGetDatum(RelationGetRelid(rel)), OIDOID);
tgscan = systable_beginscan(tgrel, TriggerRelidNameIndex, true,
SnapshotNow, 1, &key);
while (HeapTupleIsValid(tuple = systable_getnext(tgscan)))
@ -465,13 +465,15 @@ DropTrigger(Oid relid, const char *trigname, DropBehavior behavior)
*/
tgrel = heap_openr(TriggerRelationName, AccessShareLock);
ScanKeyEntryInitialize(&skey[0], 0x0,
Anum_pg_trigger_tgrelid, F_OIDEQ,
ObjectIdGetDatum(relid));
ScanKeyEntryInitialize(&skey[0], 0,
Anum_pg_trigger_tgrelid,
BTEqualStrategyNumber, F_OIDEQ,
ObjectIdGetDatum(relid), OIDOID);
ScanKeyEntryInitialize(&skey[1], 0x0,
Anum_pg_trigger_tgname, F_NAMEEQ,
CStringGetDatum(trigname));
ScanKeyEntryInitialize(&skey[1], 0,
Anum_pg_trigger_tgname,
BTEqualStrategyNumber, F_NAMEEQ,
CStringGetDatum(trigname), NAMEOID);
tgscan = systable_beginscan(tgrel, TriggerRelidNameIndex, true,
SnapshotNow, 2, skey);
@ -522,9 +524,10 @@ RemoveTriggerById(Oid trigOid)
/*
* Find the trigger to delete.
*/
ScanKeyEntryInitialize(&skey[0], 0x0,
ObjectIdAttributeNumber, F_OIDEQ,
ObjectIdGetDatum(trigOid));
ScanKeyEntryInitialize(&skey[0], 0,
ObjectIdAttributeNumber,
BTEqualStrategyNumber, F_OIDEQ,
ObjectIdGetDatum(trigOid), OIDOID);
tgscan = systable_beginscan(tgrel, TriggerOidIndex, true,
SnapshotNow, 1, skey);
@ -640,12 +643,12 @@ renametrig(Oid relid,
*/
ScanKeyEntryInitialize(&key[0], 0,
Anum_pg_trigger_tgrelid,
F_OIDEQ,
ObjectIdGetDatum(relid));
BTEqualStrategyNumber, F_OIDEQ,
ObjectIdGetDatum(relid), OIDOID);
ScanKeyEntryInitialize(&key[1], 0,
Anum_pg_trigger_tgname,
F_NAMEEQ,
PointerGetDatum(newname));
BTEqualStrategyNumber, F_NAMEEQ,
PointerGetDatum(newname), NAMEOID);
tgscan = systable_beginscan(tgrel, TriggerRelidNameIndex, true,
SnapshotNow, 2, key);
if (HeapTupleIsValid(tuple = systable_getnext(tgscan)))
@ -660,12 +663,12 @@ renametrig(Oid relid,
*/
ScanKeyEntryInitialize(&key[0], 0,
Anum_pg_trigger_tgrelid,
F_OIDEQ,
ObjectIdGetDatum(relid));
BTEqualStrategyNumber, F_OIDEQ,
ObjectIdGetDatum(relid), OIDOID);
ScanKeyEntryInitialize(&key[1], 0,
Anum_pg_trigger_tgname,
F_NAMEEQ,
PointerGetDatum(oldname));
BTEqualStrategyNumber, F_NAMEEQ,
PointerGetDatum(oldname), NAMEOID);
tgscan = systable_beginscan(tgrel, TriggerRelidNameIndex, true,
SnapshotNow, 2, key);
if (HeapTupleIsValid(tuple = systable_getnext(tgscan)))
@ -741,11 +744,11 @@ RelationBuildTriggers(Relation relation)
* emergency-recovery operations (ie, IsIgnoringSystemIndexes). This
* in turn ensures that triggers will be fired in name order.
*/
ScanKeyEntryInitialize(&skey,
(bits16) 0x0,
(AttrNumber) Anum_pg_trigger_tgrelid,
(RegProcedure) F_OIDEQ,
ObjectIdGetDatum(RelationGetRelid(relation)));
ScanKeyEntryInitialize(&skey, 0,
Anum_pg_trigger_tgrelid,
BTEqualStrategyNumber, F_OIDEQ,
ObjectIdGetDatum(RelationGetRelid(relation)),
OIDOID);
tgrel = heap_openr(TriggerRelationName, AccessShareLock);
tgscan = systable_beginscan(tgrel, TriggerRelidNameIndex, true,
@ -2259,10 +2262,10 @@ DeferredTriggerSetState(ConstraintsSetStmt *stmt)
/*
* Setup to scan pg_trigger by tgconstrname ...
*/
ScanKeyEntryInitialize(&skey, (bits16) 0x0,
(AttrNumber) Anum_pg_trigger_tgconstrname,
(RegProcedure) F_NAMEEQ,
PointerGetDatum(cname));
ScanKeyEntryInitialize(&skey, 0,
Anum_pg_trigger_tgconstrname,
BTEqualStrategyNumber, F_NAMEEQ,
PointerGetDatum(cname), NAMEOID);
tgscan = systable_beginscan(tgrel, TriggerConstrNameIndex, true,
SnapshotNow, 1, &skey);