mirror of
https://github.com/postgres/postgres.git
synced 2025-11-21 00:42:43 +03:00
Cross-data-type comparisons are now indexable by btrees, pursuant to my
pghackers proposal of 8-Nov. All the existing cross-type comparison operators (int2/int4/int8 and float4/float8) have appropriate support. The original proposal of storing the right-hand-side datatype as part of the primary key for pg_amop and pg_amproc got modified a bit in the event; it is easier to store zero as the 'default' case and only store a nonzero when the operator is actually cross-type. Along the way, remove the long-since-defunct bigbox_ops operator class.
This commit is contained in:
@@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/access/heap/tuptoaster.c,v 1.39 2003/11/09 21:30:35 tgl Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/access/heap/tuptoaster.c,v 1.40 2003/11/12 21:15:46 tgl Exp $
|
||||
*
|
||||
*
|
||||
* INTERFACE ROUTINES
|
||||
@@ -31,7 +31,6 @@
|
||||
#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"
|
||||
@@ -968,11 +967,10 @@ 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, 0,
|
||||
(AttrNumber) 1,
|
||||
BTEqualStrategyNumber, F_OIDEQ,
|
||||
ObjectIdGetDatum(attr->va_content.va_external.va_valueid),
|
||||
OIDOID);
|
||||
ScanKeyInit(&toastkey,
|
||||
(AttrNumber) 1,
|
||||
BTEqualStrategyNumber, F_OIDEQ,
|
||||
ObjectIdGetDatum(attr->va_content.va_external.va_valueid));
|
||||
|
||||
/*
|
||||
* Find the chunks by index
|
||||
@@ -1040,11 +1038,10 @@ toast_fetch_datum(varattrib *attr)
|
||||
/*
|
||||
* Setup a scan key to fetch from the index by va_valueid
|
||||
*/
|
||||
ScanKeyEntryInitialize(&toastkey, 0,
|
||||
(AttrNumber) 1,
|
||||
BTEqualStrategyNumber, F_OIDEQ,
|
||||
ObjectIdGetDatum(attr->va_content.va_external.va_valueid),
|
||||
OIDOID);
|
||||
ScanKeyInit(&toastkey,
|
||||
(AttrNumber) 1,
|
||||
BTEqualStrategyNumber, F_OIDEQ,
|
||||
ObjectIdGetDatum(attr->va_content.va_external.va_valueid));
|
||||
|
||||
/*
|
||||
* Read the chunks by index
|
||||
@@ -1195,33 +1192,32 @@ 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], 0,
|
||||
(AttrNumber) 1,
|
||||
BTEqualStrategyNumber, F_OIDEQ,
|
||||
ObjectIdGetDatum(attr->va_content.va_external.va_valueid),
|
||||
OIDOID);
|
||||
ScanKeyInit(&toastkey[0],
|
||||
(AttrNumber) 1,
|
||||
BTEqualStrategyNumber, F_OIDEQ,
|
||||
ObjectIdGetDatum(attr->va_content.va_external.va_valueid));
|
||||
|
||||
/*
|
||||
* Use equality condition for one chunk, a range condition otherwise:
|
||||
*/
|
||||
if (numchunks == 1)
|
||||
{
|
||||
ScanKeyEntryInitialize(&toastkey[1], 0,
|
||||
(AttrNumber) 2,
|
||||
BTEqualStrategyNumber, F_INT4EQ,
|
||||
Int32GetDatum(startchunk), INT4OID);
|
||||
ScanKeyInit(&toastkey[1],
|
||||
(AttrNumber) 2,
|
||||
BTEqualStrategyNumber, F_INT4EQ,
|
||||
Int32GetDatum(startchunk));
|
||||
nscankeys = 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
ScanKeyEntryInitialize(&toastkey[1], 0,
|
||||
(AttrNumber) 2,
|
||||
BTGreaterEqualStrategyNumber, F_INT4GE,
|
||||
Int32GetDatum(startchunk), INT4OID);
|
||||
ScanKeyEntryInitialize(&toastkey[2], 0,
|
||||
(AttrNumber) 2,
|
||||
BTLessEqualStrategyNumber, F_INT4LE,
|
||||
Int32GetDatum(endchunk), INT4OID);
|
||||
ScanKeyInit(&toastkey[1],
|
||||
(AttrNumber) 2,
|
||||
BTGreaterEqualStrategyNumber, F_INT4GE,
|
||||
Int32GetDatum(startchunk));
|
||||
ScanKeyInit(&toastkey[2],
|
||||
(AttrNumber) 2,
|
||||
BTLessEqualStrategyNumber, F_INT4LE,
|
||||
Int32GetDatum(endchunk));
|
||||
nscankeys = 3;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user