1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-21 16:02:15 +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

@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/heap/tuptoaster.c,v 1.38 2003/08/04 23:59:37 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/access/heap/tuptoaster.c,v 1.39 2003/11/09 21:30:35 tgl Exp $
*
*
* INTERFACE ROUTINES
@ -31,6 +31,7 @@
#include "access/genam.h"
#include "access/tuptoaster.h"
#include "catalog/catalog.h"
#include "catalog/pg_type.h"
#include "utils/rel.h"
#include "utils/builtins.h"
#include "utils/fmgroids.h"
@ -967,11 +968,11 @@ toast_delete_datum(Relation rel, Datum value)
* Setup a scan key to fetch from the index by va_valueid (we don't
* particularly care whether we see them in sequence or not)
*/
ScanKeyEntryInitialize(&toastkey,
(bits16) 0,
ScanKeyEntryInitialize(&toastkey, 0,
(AttrNumber) 1,
(RegProcedure) F_OIDEQ,
ObjectIdGetDatum(attr->va_content.va_external.va_valueid));
BTEqualStrategyNumber, F_OIDEQ,
ObjectIdGetDatum(attr->va_content.va_external.va_valueid),
OIDOID);
/*
* Find the chunks by index
@ -1039,11 +1040,11 @@ toast_fetch_datum(varattrib *attr)
/*
* Setup a scan key to fetch from the index by va_valueid
*/
ScanKeyEntryInitialize(&toastkey,
(bits16) 0,
ScanKeyEntryInitialize(&toastkey, 0,
(AttrNumber) 1,
(RegProcedure) F_OIDEQ,
ObjectIdGetDatum(attr->va_content.va_external.va_valueid));
BTEqualStrategyNumber, F_OIDEQ,
ObjectIdGetDatum(attr->va_content.va_external.va_valueid),
OIDOID);
/*
* Read the chunks by index
@ -1194,37 +1195,33 @@ toast_fetch_datum_slice(varattrib *attr, int32 sliceoffset, int32 length)
* Setup a scan key to fetch from the index. This is either two keys
* or three depending on the number of chunks.
*/
ScanKeyEntryInitialize(&toastkey[0],
(bits16) 0,
ScanKeyEntryInitialize(&toastkey[0], 0,
(AttrNumber) 1,
(RegProcedure) F_OIDEQ,
ObjectIdGetDatum(attr->va_content.va_external.va_valueid));
BTEqualStrategyNumber, F_OIDEQ,
ObjectIdGetDatum(attr->va_content.va_external.va_valueid),
OIDOID);
/*
* Now dependent on number of chunks:
* Use equality condition for one chunk, a range condition otherwise:
*/
if (numchunks == 1)
{
ScanKeyEntryInitialize(&toastkey[1],
(bits16) 0,
ScanKeyEntryInitialize(&toastkey[1], 0,
(AttrNumber) 2,
(RegProcedure) F_INT4EQ,
Int32GetDatum(startchunk));
BTEqualStrategyNumber, F_INT4EQ,
Int32GetDatum(startchunk), INT4OID);
nscankeys = 2;
}
else
{
ScanKeyEntryInitialize(&toastkey[1],
(bits16) 0,
ScanKeyEntryInitialize(&toastkey[1], 0,
(AttrNumber) 2,
(RegProcedure) F_INT4GE,
Int32GetDatum(startchunk));
ScanKeyEntryInitialize(&toastkey[2],
(bits16) 0,
BTGreaterEqualStrategyNumber, F_INT4GE,
Int32GetDatum(startchunk), INT4OID);
ScanKeyEntryInitialize(&toastkey[2], 0,
(AttrNumber) 2,
(RegProcedure) F_INT4LE,
Int32GetDatum(endchunk));
BTLessEqualStrategyNumber, F_INT4LE,
Int32GetDatum(endchunk), INT4OID);
nscankeys = 3;
}