Commit fa5c8a05 authored by Tom Lane's avatar Tom Lane

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.
parent 49f98fa8
...@@ -1357,10 +1357,10 @@ get_pkey_attnames(Oid relid, int16 *numatts) ...@@ -1357,10 +1357,10 @@ get_pkey_attnames(Oid relid, int16 *numatts)
/* use relid to get all related indexes */ /* use relid to get all related indexes */
indexRelation = heap_openr(IndexRelationName, AccessShareLock); indexRelation = heap_openr(IndexRelationName, AccessShareLock);
ScanKeyEntryInitialize(&entry, 0, ScanKeyInit(&entry,
Anum_pg_index_indrelid, Anum_pg_index_indrelid,
BTEqualStrategyNumber, F_OIDEQ, BTEqualStrategyNumber, F_OIDEQ,
ObjectIdGetDatum(relid), OIDOID); ObjectIdGetDatum(relid));
scan = heap_beginscan(indexRelation, SnapshotNow, 1, &entry); scan = heap_beginscan(indexRelation, SnapshotNow, 1, &entry);
while ((indexTuple = heap_getnext(scan, ForwardScanDirection)) != NULL) while ((indexTuple = heap_getnext(scan, ForwardScanDirection)) != NULL)
......
...@@ -21,7 +21,6 @@ ...@@ -21,7 +21,6 @@
#include "access/tupdesc.h" #include "access/tupdesc.h"
#include "catalog/catname.h" #include "catalog/catname.h"
#include "catalog/pg_listener.h" #include "catalog/pg_listener.h"
#include "catalog/pg_type.h"
#include "commands/async.h" #include "commands/async.h"
#include "fmgr.h" #include "fmgr.h"
#include "storage/lmgr.h" #include "storage/lmgr.h"
...@@ -87,10 +86,10 @@ active_listeners(text *relname) ...@@ -87,10 +86,10 @@ active_listeners(text *relname)
MemSet(listen_name, 0, NAMEDATALEN); MemSet(listen_name, 0, NAMEDATALEN);
len = MIN(VARSIZE(relname) - VARHDRSZ, NAMEDATALEN - 1); len = MIN(VARSIZE(relname) - VARHDRSZ, NAMEDATALEN - 1);
memcpy(listen_name, VARDATA(relname), len); memcpy(listen_name, VARDATA(relname), len);
ScanKeyEntryInitialize(&key, 0, ScanKeyInit(&key,
Anum_pg_listener_relname, Anum_pg_listener_relname,
BTEqualStrategyNumber, F_NAMEEQ, BTEqualStrategyNumber, F_NAMEEQ,
PointerGetDatum(listen_name), NAMEOID); PointerGetDatum(listen_name));
sRel = heap_beginscan(lRel, SnapshotNow, 1, &key); sRel = heap_beginscan(lRel, SnapshotNow, 1, &key);
} }
else else
......
<!-- <!--
Documentation of the system catalogs, directed toward PostgreSQL developers Documentation of the system catalogs, directed toward PostgreSQL developers
$Header: /cvsroot/pgsql/doc/src/sgml/catalogs.sgml,v 2.78 2003/11/02 12:53:57 petere Exp $ $Header: /cvsroot/pgsql/doc/src/sgml/catalogs.sgml,v 2.79 2003/11/12 21:15:42 tgl Exp $
--> -->
<chapter id="catalogs"> <chapter id="catalogs">
...@@ -499,6 +499,14 @@ ...@@ -499,6 +499,14 @@
<entry>The index operator class this entry is for</entry> <entry>The index operator class this entry is for</entry>
</row> </row>
<row>
<entry><structfield>amopsubtype</structfield></entry>
<entry><type>oid</type></entry>
<entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
<entry>Subtype to distinguish multiple entries for one strategy;
zero for default</entry>
</row>
<row> <row>
<entry><structfield>amopstrategy</structfield></entry> <entry><structfield>amopstrategy</structfield></entry>
<entry><type>int2</type></entry> <entry><type>int2</type></entry>
...@@ -562,6 +570,13 @@ ...@@ -562,6 +570,13 @@
<entry>The index operator class this entry is for</entry> <entry>The index operator class this entry is for</entry>
</row> </row>
<row>
<entry><structfield>amprocsubtype</structfield></entry>
<entry><type>oid</type></entry>
<entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
<entry>Subtype, if cross-type routine, else zero</entry>
</row>
<row> <row>
<entry><structfield>amprocnum</structfield></entry> <entry><structfield>amprocnum</structfield></entry>
<entry><type>int2</type></entry> <entry><type>int2</type></entry>
...@@ -2435,7 +2450,7 @@ ...@@ -2435,7 +2450,7 @@
<entry><structfield>opcintype</structfield></entry> <entry><structfield>opcintype</structfield></entry>
<entry><type>oid</type></entry> <entry><type>oid</type></entry>
<entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry> <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
<entry>Input data type of the operator class</entry> <entry>Data type that the operator class indexes</entry>
</row> </row>
<row> <row>
...@@ -2449,7 +2464,7 @@ ...@@ -2449,7 +2464,7 @@
<entry><structfield>opckeytype</structfield></entry> <entry><structfield>opckeytype</structfield></entry>
<entry><type>oid</type></entry> <entry><type>oid</type></entry>
<entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry> <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
<entry>Type of index data, or zero if same as <structfield>opcintype</></entry> <entry>Type of data stored in index, or zero if same as <structfield>opcintype</></entry>
</row> </row>
</tbody> </tbody>
......
<!-- <!--
$Header: /cvsroot/pgsql/doc/src/sgml/xindex.sgml,v 1.34 2003/11/01 01:56:29 petere Exp $ $Header: /cvsroot/pgsql/doc/src/sgml/xindex.sgml,v 1.35 2003/11/12 21:15:45 tgl Exp $
--> -->
<sect1 id="xindex"> <sect1 id="xindex">
...@@ -80,7 +80,7 @@ $Header: /cvsroot/pgsql/doc/src/sgml/xindex.sgml,v 1.34 2003/11/01 01:56:29 pete ...@@ -80,7 +80,7 @@ $Header: /cvsroot/pgsql/doc/src/sgml/xindex.sgml,v 1.34 2003/11/01 01:56:29 pete
The same operator class name The same operator class name
can be used for several different index methods (for example, both B-tree can be used for several different index methods (for example, both B-tree
and hash index methods have operator classes named and hash index methods have operator classes named
<literal>oid_ops</literal>), but each such class is an independent <literal>int4_ops</literal>), but each such class is an independent
entity and must be defined separately. entity and must be defined separately.
</para> </para>
</sect2> </sect2>
...@@ -589,6 +589,71 @@ CREATE OPERATOR CLASS complex_abs_ops ...@@ -589,6 +589,71 @@ CREATE OPERATOR CLASS complex_abs_ops
</para> </para>
</sect2> </sect2>
<sect2 id="xindex-opclass-crosstype">
<title>Cross-Data-Type Operator Classes</title>
<para>
So far we have implicitly assumed that an operator class deals with
only one data type. While there certainly can be only one data type in
a particular index column, it is often useful to index operations that
compare an indexed column to a value of a different data type. This is
presently supported by the B-tree and GiST index methods.
</para>
<para>
B-trees require the left-hand operand of each operator to be the indexed
data type, but the right-hand operand can be of a different type. There
must be a support function having a matching signature. For example,
the built-in operator class for type <type>bigint</> (<type>int8</>)
allows cross-type comparisons to <type>int4</> and <type>int2</>. It
could be duplicated by this definition:
<programlisting>
CREATE OPERATOR CLASS int8_ops
DEFAULT FOR TYPE int8 USING btree AS
-- standard int8 comparisons
OPERATOR 1 &lt; ,
OPERATOR 2 &lt;= ,
OPERATOR 3 = ,
OPERATOR 4 &gt;= ,
OPERATOR 5 &gt; ,
FUNCTION 1 btint8cmp(int8, int8) ,
-- cross-type comparisons to int2 (smallint)
OPERATOR 1 &lt; (int8, int2) ,
OPERATOR 2 &lt;= (int8, int2) ,
OPERATOR 3 = (int8, int2) ,
OPERATOR 4 &gt;= (int8, int2) ,
OPERATOR 5 &gt; (int8, int2) ,
FUNCTION 1 btint82cmp(int8, int2) ,
-- cross-type comparisons to int4 (integer)
OPERATOR 1 &lt; (int8, int4) ,
OPERATOR 2 &lt;= (int8, int4) ,
OPERATOR 3 = (int8, int4) ,
OPERATOR 4 &gt;= (int8, int4) ,
OPERATOR 5 &gt; (int8, int4) ,
FUNCTION 1 btint84cmp(int8, int4) ;
</programlisting>
Notice that this definition <quote>overloads</> the operator strategy and
support function numbers. This is allowed (for B-tree operator classes
only) so long as each instance of a particular number has a different
right-hand data type. The instances that are not cross-type are the
default or primary operators of the operator class.
</para>
<para>
GiST indexes do not allow overloading of strategy or support function
numbers, but it is still possible to get the effect of supporting
multiple right-hand data types, by assigning a distinct strategy number
to each operator that needs to be supported. The <literal>consistent</>
support function must determine what it needs to do based on the strategy
number, and must be prepared to accept comparison values of the appropriate
data types.
</para>
</sect2>
<sect2 id="xindex-opclass-dependencies"> <sect2 id="xindex-opclass-dependencies">
<title>System Dependencies on Operator Classes</title> <title>System Dependencies on Operator Classes</title>
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/common/scankey.c,v 1.23 2003/11/09 21:30:35 tgl Exp $ * $Header: /cvsroot/pgsql/src/backend/access/common/scankey.c,v 1.24 2003/11/12 21:15:46 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -31,15 +31,43 @@ ScanKeyEntryInitialize(ScanKey entry, ...@@ -31,15 +31,43 @@ ScanKeyEntryInitialize(ScanKey entry,
int flags, int flags,
AttrNumber attributeNumber, AttrNumber attributeNumber,
StrategyNumber strategy, StrategyNumber strategy,
Oid subtype,
RegProcedure procedure, RegProcedure procedure,
Datum argument, Datum argument)
Oid argtype)
{ {
entry->sk_flags = flags; entry->sk_flags = flags;
entry->sk_attno = attributeNumber; entry->sk_attno = attributeNumber;
entry->sk_strategy = strategy; entry->sk_strategy = strategy;
entry->sk_subtype = subtype;
entry->sk_argument = argument;
fmgr_info(procedure, &entry->sk_func);
}
/*
* ScanKeyInit
* Shorthand version of ScanKeyEntryInitialize: flags and subtype
* are assumed to be zero (the usual value).
*
* This is the recommended version for hardwired lookups in system catalogs.
* It cannot handle NULL arguments, unary operators, or nondefault operators,
* but we need none of those features for most hardwired lookups.
*
* Note: CurrentMemoryContext at call should be as long-lived as the ScanKey
* itself, because that's what will be used for any subsidiary info attached
* to the ScanKey's FmgrInfo record.
*/
void
ScanKeyInit(ScanKey entry,
AttrNumber attributeNumber,
StrategyNumber strategy,
RegProcedure procedure,
Datum argument)
{
entry->sk_flags = 0;
entry->sk_attno = attributeNumber;
entry->sk_strategy = strategy;
entry->sk_subtype = InvalidOid;
entry->sk_argument = argument; entry->sk_argument = argument;
entry->sk_argtype = argtype;
fmgr_info(procedure, &entry->sk_func); fmgr_info(procedure, &entry->sk_func);
} }
...@@ -57,14 +85,14 @@ ScanKeyEntryInitializeWithInfo(ScanKey entry, ...@@ -57,14 +85,14 @@ ScanKeyEntryInitializeWithInfo(ScanKey entry,
int flags, int flags,
AttrNumber attributeNumber, AttrNumber attributeNumber,
StrategyNumber strategy, StrategyNumber strategy,
Oid subtype,
FmgrInfo *finfo, FmgrInfo *finfo,
Datum argument, Datum argument)
Oid argtype)
{ {
entry->sk_flags = flags; entry->sk_flags = flags;
entry->sk_attno = attributeNumber; entry->sk_attno = attributeNumber;
entry->sk_strategy = strategy; entry->sk_strategy = strategy;
entry->sk_subtype = subtype;
entry->sk_argument = argument; entry->sk_argument = argument;
entry->sk_argtype = argtype;
fmgr_info_copy(&entry->sk_func, finfo, CurrentMemoryContext); fmgr_info_copy(&entry->sk_func, finfo, CurrentMemoryContext);
} }
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,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/access/gist/gistget.c,v 1.37 2003/11/09 21:30:35 tgl Exp $ * $Header: /cvsroot/pgsql/src/backend/access/gist/gistget.c,v 1.38 2003/11/12 21:15:46 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -221,40 +221,50 @@ gistindex_keytest(IndexTuple tuple, ...@@ -221,40 +221,50 @@ gistindex_keytest(IndexTuple tuple,
Page p, Page p,
OffsetNumber offset) OffsetNumber offset)
{ {
bool isNull;
Datum datum;
Datum test;
GISTENTRY de;
IncrIndexProcessed(); IncrIndexProcessed();
while (scanKeySize > 0) while (scanKeySize > 0)
{ {
Datum datum;
bool isNull;
Datum test;
GISTENTRY de;
datum = index_getattr(tuple, datum = index_getattr(tuple,
key[0].sk_attno, key->sk_attno,
giststate->tupdesc, giststate->tupdesc,
&isNull); &isNull);
/* is the index entry NULL? */
if (isNull) if (isNull)
{ {
/* XXX eventually should check if SK_ISNULL */ /* XXX eventually should check if SK_ISNULL */
return false; return false;
} }
/* is the compared-to datum NULL? */
/* this code from backend/access/common/indexvalid.c. But why and what??? if (key->sk_flags & SK_ISNULL)
if (key[0].sk_flags & SK_ISNULL)
return false; return false;
*/
gistdentryinit(giststate, key[0].sk_attno - 1, &de, gistdentryinit(giststate, key->sk_attno - 1, &de,
datum, r, p, offset, datum, r, p, offset,
IndexTupleSize(tuple) - sizeof(IndexTupleData), IndexTupleSize(tuple) - sizeof(IndexTupleData),
FALSE, isNull); FALSE, isNull);
test = FunctionCall3(&key[0].sk_func, /*
* Call the Consistent function to evaluate the test. The arguments
* are the index datum (as a GISTENTRY*), the comparison datum, and
* the comparison operator's strategy number and subtype from pg_amop.
*
* (Presently there's no need to pass the subtype since it'll always
* be zero, but might as well pass it for possible future use.)
*/
test = FunctionCall4(&key->sk_func,
PointerGetDatum(&de), PointerGetDatum(&de),
key[0].sk_argument, key->sk_argument,
Int32GetDatum(key[0].sk_strategy)); Int32GetDatum(key->sk_strategy),
ObjectIdGetDatum(key->sk_subtype));
if (de.key != datum && !isAttByVal(giststate, key[0].sk_attno - 1)) /* if index datum had to be decompressed, free it */
if (de.key != datum && !isAttByVal(giststate, key->sk_attno - 1))
if (DatumGetPointer(de.key) != NULL) if (DatumGetPointer(de.key) != NULL)
pfree(DatumGetPointer(de.key)); pfree(DatumGetPointer(de.key));
...@@ -264,6 +274,7 @@ gistindex_keytest(IndexTuple tuple, ...@@ -264,6 +274,7 @@ gistindex_keytest(IndexTuple tuple,
scanKeySize--; scanKeySize--;
key++; key++;
} }
return true; return true;
} }
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,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/access/gist/gistscan.c,v 1.48 2003/11/09 21:30:35 tgl Exp $ * $Header: /cvsroot/pgsql/src/backend/access/gist/gistscan.c,v 1.49 2003/11/12 21:15:46 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -109,7 +109,8 @@ gistrescan(PG_FUNCTION_ARGS) ...@@ -109,7 +109,8 @@ gistrescan(PG_FUNCTION_ARGS)
* Modify the scan key so that the Consistent function is called * Modify the scan key so that the Consistent function is called
* for all comparisons. The original operator is passed to the * for all comparisons. The original operator is passed to the
* Consistent function in the form of its strategy number, which * Consistent function in the form of its strategy number, which
* is available from the sk_strategy field. * is available from the sk_strategy field, and its subtype from
* the sk_subtype field.
*/ */
for (i = 0; i < s->numberOfKeys; i++) for (i = 0; i < s->numberOfKeys; i++)
{ {
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * 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 * INTERFACE ROUTINES
...@@ -31,7 +31,6 @@ ...@@ -31,7 +31,6 @@
#include "access/genam.h" #include "access/genam.h"
#include "access/tuptoaster.h" #include "access/tuptoaster.h"
#include "catalog/catalog.h" #include "catalog/catalog.h"
#include "catalog/pg_type.h"
#include "utils/rel.h" #include "utils/rel.h"
#include "utils/builtins.h" #include "utils/builtins.h"
#include "utils/fmgroids.h" #include "utils/fmgroids.h"
...@@ -968,11 +967,10 @@ toast_delete_datum(Relation rel, Datum value) ...@@ -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 * 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) * particularly care whether we see them in sequence or not)
*/ */
ScanKeyEntryInitialize(&toastkey, 0, ScanKeyInit(&toastkey,
(AttrNumber) 1, (AttrNumber) 1,
BTEqualStrategyNumber, F_OIDEQ, BTEqualStrategyNumber, F_OIDEQ,
ObjectIdGetDatum(attr->va_content.va_external.va_valueid), ObjectIdGetDatum(attr->va_content.va_external.va_valueid));
OIDOID);
/* /*
* Find the chunks by index * Find the chunks by index
...@@ -1040,11 +1038,10 @@ toast_fetch_datum(varattrib *attr) ...@@ -1040,11 +1038,10 @@ toast_fetch_datum(varattrib *attr)
/* /*
* Setup a scan key to fetch from the index by va_valueid * Setup a scan key to fetch from the index by va_valueid
*/ */
ScanKeyEntryInitialize(&toastkey, 0, ScanKeyInit(&toastkey,
(AttrNumber) 1, (AttrNumber) 1,
BTEqualStrategyNumber, F_OIDEQ, BTEqualStrategyNumber, F_OIDEQ,
ObjectIdGetDatum(attr->va_content.va_external.va_valueid), ObjectIdGetDatum(attr->va_content.va_external.va_valueid));
OIDOID);
/* /*
* Read the chunks by index * Read the chunks by index
...@@ -1195,33 +1192,32 @@ toast_fetch_datum_slice(varattrib *attr, int32 sliceoffset, int32 length) ...@@ -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 * Setup a scan key to fetch from the index. This is either two keys
* or three depending on the number of chunks. * or three depending on the number of chunks.
*/ */
ScanKeyEntryInitialize(&toastkey[0], 0, ScanKeyInit(&toastkey[0],
(AttrNumber) 1, (AttrNumber) 1,
BTEqualStrategyNumber, F_OIDEQ, BTEqualStrategyNumber, F_OIDEQ,
ObjectIdGetDatum(attr->va_content.va_external.va_valueid), ObjectIdGetDatum(attr->va_content.va_external.va_valueid));
OIDOID);
/* /*
* Use equality condition for one chunk, a range condition otherwise: * Use equality condition for one chunk, a range condition otherwise:
*/ */
if (numchunks == 1) if (numchunks == 1)
{ {
ScanKeyEntryInitialize(&toastkey[1], 0, ScanKeyInit(&toastkey[1],
(AttrNumber) 2, (AttrNumber) 2,
BTEqualStrategyNumber, F_INT4EQ, BTEqualStrategyNumber, F_INT4EQ,
Int32GetDatum(startchunk), INT4OID); Int32GetDatum(startchunk));
nscankeys = 2; nscankeys = 2;
} }
else else
{ {
ScanKeyEntryInitialize(&toastkey[1], 0, ScanKeyInit(&toastkey[1],
(AttrNumber) 2, (AttrNumber) 2,
BTGreaterEqualStrategyNumber, F_INT4GE, BTGreaterEqualStrategyNumber, F_INT4GE,
Int32GetDatum(startchunk), INT4OID); Int32GetDatum(startchunk));
ScanKeyEntryInitialize(&toastkey[2], 0, ScanKeyInit(&toastkey[2],
(AttrNumber) 2, (AttrNumber) 2,
BTLessEqualStrategyNumber, F_INT4LE, BTLessEqualStrategyNumber, F_INT4LE,
Int32GetDatum(endchunk), INT4OID); Int32GetDatum(endchunk));
nscankeys = 3; nscankeys = 3;
} }
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtcompare.c,v 1.46 2003/08/04 02:39:57 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtcompare.c,v 1.47 2003/11/12 21:15:46 tgl Exp $
* *
* NOTES * NOTES
* *
...@@ -97,6 +97,90 @@ btint8cmp(PG_FUNCTION_ARGS) ...@@ -97,6 +97,90 @@ btint8cmp(PG_FUNCTION_ARGS)
PG_RETURN_INT32(-1); PG_RETURN_INT32(-1);
} }
Datum
btint48cmp(PG_FUNCTION_ARGS)
{
int32 a = PG_GETARG_INT32(0);
int64 b = PG_GETARG_INT64(1);
if (a > b)
PG_RETURN_INT32(1);
else if (a == b)
PG_RETURN_INT32(0);
else
PG_RETURN_INT32(-1);
}
Datum
btint84cmp(PG_FUNCTION_ARGS)
{
int64 a = PG_GETARG_INT64(0);
int32 b = PG_GETARG_INT32(1);
if (a > b)
PG_RETURN_INT32(1);
else if (a == b)
PG_RETURN_INT32(0);
else
PG_RETURN_INT32(-1);
}
Datum
btint24cmp(PG_FUNCTION_ARGS)
{
int16 a = PG_GETARG_INT16(0);
int32 b = PG_GETARG_INT32(1);
if (a > b)
PG_RETURN_INT32(1);
else if (a == b)
PG_RETURN_INT32(0);
else
PG_RETURN_INT32(-1);
}
Datum
btint42cmp(PG_FUNCTION_ARGS)
{
int32 a = PG_GETARG_INT32(0);
int16 b = PG_GETARG_INT16(1);
if (a > b)
PG_RETURN_INT32(1);
else if (a == b)
PG_RETURN_INT32(0);
else
PG_RETURN_INT32(-1);
}
Datum
btint28cmp(PG_FUNCTION_ARGS)
{
int16 a = PG_GETARG_INT16(0);
int64 b = PG_GETARG_INT64(1);
if (a > b)
PG_RETURN_INT32(1);
else if (a == b)
PG_RETURN_INT32(0);
else
PG_RETURN_INT32(-1);
}
Datum
btint82cmp(PG_FUNCTION_ARGS)
{
int64 a = PG_GETARG_INT64(0);
int16 b = PG_GETARG_INT16(1);
if (a > b)
PG_RETURN_INT32(1);
else if (a == b)
PG_RETURN_INT32(0);
else
PG_RETURN_INT32(-1);
}
Datum Datum
btoidcmp(PG_FUNCTION_ARGS) btoidcmp(PG_FUNCTION_ARGS)
{ {
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtinsert.c,v 1.107 2003/11/09 21:30:35 tgl Exp $ * $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtinsert.c,v 1.108 2003/11/12 21:15:46 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -1577,26 +1577,27 @@ _bt_isequal(TupleDesc itupdesc, Page page, OffsetNumber offnum, ...@@ -1577,26 +1577,27 @@ _bt_isequal(TupleDesc itupdesc, Page page, OffsetNumber offnum,
for (i = 1; i <= keysz; i++) for (i = 1; i <= keysz; i++)
{ {
ScanKey entry = &scankey[i - 1];
AttrNumber attno; AttrNumber attno;
Datum datum; Datum datum;
bool isNull; bool isNull;
int32 result; int32 result;
attno = entry->sk_attno; attno = scankey->sk_attno;
Assert(attno == i); Assert(attno == i);
datum = index_getattr(itup, attno, itupdesc, &isNull); datum = index_getattr(itup, attno, itupdesc, &isNull);
/* NULLs are never equal to anything */ /* NULLs are never equal to anything */
if ((entry->sk_flags & SK_ISNULL) || isNull) if (isNull || (scankey->sk_flags & SK_ISNULL))
return false; return false;
result = DatumGetInt32(FunctionCall2(&entry->sk_func, result = DatumGetInt32(FunctionCall2(&scankey->sk_func,
entry->sk_argument, datum,
datum)); scankey->sk_argument));
if (result != 0) if (result != 0)
return false; return false;
scankey++;
} }
/* if we get here, the keys are equal */ /* if we get here, the keys are equal */
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,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/access/nbtree/nbtree.c,v 1.106 2003/09/29 23:40:26 tgl Exp $ * $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtree.c,v 1.107 2003/11/12 21:15:46 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -397,7 +397,6 @@ btrescan(PG_FUNCTION_ARGS) ...@@ -397,7 +397,6 @@ btrescan(PG_FUNCTION_ARGS)
so->keyData = (ScanKey) palloc(scan->numberOfKeys * sizeof(ScanKeyData)); so->keyData = (ScanKey) palloc(scan->numberOfKeys * sizeof(ScanKeyData));
else else
so->keyData = (ScanKey) NULL; so->keyData = (ScanKey) NULL;
so->numberOfKeys = scan->numberOfKeys;
scan->opaque = so; scan->opaque = so;
} }
...@@ -423,38 +422,14 @@ btrescan(PG_FUNCTION_ARGS) ...@@ -423,38 +422,14 @@ btrescan(PG_FUNCTION_ARGS)
* _bt_first. - vadim 05/05/97 * _bt_first. - vadim 05/05/97
*/ */
if (scankey && scan->numberOfKeys > 0) if (scankey && scan->numberOfKeys > 0)
{
memmove(scan->keyData, memmove(scan->keyData,
scankey, scankey,
scan->numberOfKeys * sizeof(ScanKeyData)); scan->numberOfKeys * sizeof(ScanKeyData));
so->numberOfKeys = scan->numberOfKeys; so->numberOfKeys = 0; /* until _bt_preprocess_keys sets it */
memmove(so->keyData,
scankey,
so->numberOfKeys * sizeof(ScanKeyData));
}
PG_RETURN_VOID(); PG_RETURN_VOID();
} }
void
btmovescan(IndexScanDesc scan, Datum v)
{
ItemPointer iptr;
BTScanOpaque so;
so = (BTScanOpaque) scan->opaque;
/* we aren't holding any read locks, but gotta drop the pin */
if (ItemPointerIsValid(iptr = &(scan->currentItemData)))
{
ReleaseBuffer(so->btso_curbuf);
so->btso_curbuf = InvalidBuffer;
ItemPointerSetInvalid(iptr);
}
so->keyData[0].sk_argument = v;
}
/* /*
* btendscan() -- close down a scan * btendscan() -- close down a scan
*/ */
......
This diff is collapsed.
...@@ -36,7 +36,7 @@ ...@@ -36,7 +36,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/access/nbtree/nbtsort.c,v 1.77 2003/09/29 23:40:26 tgl Exp $ * $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtsort.c,v 1.78 2003/11/12 21:15:47 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -594,33 +594,37 @@ _bt_load(Relation index, BTSpool *btspool, BTSpool *btspool2) ...@@ -594,33 +594,37 @@ _bt_load(Relation index, BTSpool *btspool, BTSpool *btspool2)
* Another BTSpool for dead tuples exists. Now we have to merge * Another BTSpool for dead tuples exists. Now we have to merge
* btspool and btspool2. * btspool and btspool2.
*/ */
ScanKey entry;
Datum attrDatum1,
attrDatum2;
bool isFirstNull,
isSecondNull;
int32 compare;
/* the preparation of merge */ /* the preparation of merge */
bti = (BTItem) tuplesort_getindextuple(btspool->sortstate, true, &should_free); bti = (BTItem) tuplesort_getindextuple(btspool->sortstate,
bti2 = (BTItem) tuplesort_getindextuple(btspool2->sortstate, true, &should_free2); true, &should_free);
bti2 = (BTItem) tuplesort_getindextuple(btspool2->sortstate,
true, &should_free2);
indexScanKey = _bt_mkscankey_nodata(index); indexScanKey = _bt_mkscankey_nodata(index);
for (;;) for (;;)
{ {
load1 = true; /* load BTSpool next ? */ load1 = true; /* load BTSpool next ? */
if (NULL == bti2) if (bti2 == NULL)
{ {
if (NULL == bti) if (bti == NULL)
break; break;
} }
else if (NULL != bti) else if (bti != NULL)
{ {
for (i = 1; i <= keysz; i++) for (i = 1; i <= keysz; i++)
{ {
ScanKey entry;
Datum attrDatum1,
attrDatum2;
bool isFirstNull,
isSecondNull;
entry = indexScanKey + i - 1; entry = indexScanKey + i - 1;
attrDatum1 = index_getattr((IndexTuple) bti, i, tupdes, &isFirstNull); attrDatum1 = index_getattr((IndexTuple) bti, i, tupdes,
attrDatum2 = index_getattr((IndexTuple) bti2, i, tupdes, &isSecondNull); &isFirstNull);
attrDatum2 = index_getattr((IndexTuple) bti2, i, tupdes,
&isSecondNull);
if (isFirstNull) if (isFirstNull)
{ {
if (!isSecondNull) if (!isSecondNull)
...@@ -633,7 +637,11 @@ _bt_load(Relation index, BTSpool *btspool, BTSpool *btspool2) ...@@ -633,7 +637,11 @@ _bt_load(Relation index, BTSpool *btspool, BTSpool *btspool2)
break; break;
else else
{ {
compare = DatumGetInt32(FunctionCall2(&entry->sk_func, attrDatum1, attrDatum2)); int32 compare;
compare = DatumGetInt32(FunctionCall2(&entry->sk_func,
attrDatum1,
attrDatum2));
if (compare > 0) if (compare > 0)
{ {
load1 = false; load1 = false;
...@@ -656,14 +664,16 @@ _bt_load(Relation index, BTSpool *btspool, BTSpool *btspool2) ...@@ -656,14 +664,16 @@ _bt_load(Relation index, BTSpool *btspool, BTSpool *btspool2)
_bt_buildadd(index, state, bti); _bt_buildadd(index, state, bti);
if (should_free) if (should_free)
pfree((void *) bti); pfree((void *) bti);
bti = (BTItem) tuplesort_getindextuple(btspool->sortstate, true, &should_free); bti = (BTItem) tuplesort_getindextuple(btspool->sortstate,
true, &should_free);
} }
else else
{ {
_bt_buildadd(index, state, bti2); _bt_buildadd(index, state, bti2);
if (should_free2) if (should_free2)
pfree((void *) bti2); pfree((void *) bti2);
bti2 = (BTItem) tuplesort_getindextuple(btspool2->sortstate, true, &should_free2); bti2 = (BTItem) tuplesort_getindextuple(btspool2->sortstate,
true, &should_free2);
} }
} }
_bt_freeskey(indexScanKey); _bt_freeskey(indexScanKey);
...@@ -671,7 +681,8 @@ _bt_load(Relation index, BTSpool *btspool, BTSpool *btspool2) ...@@ -671,7 +681,8 @@ _bt_load(Relation index, BTSpool *btspool, BTSpool *btspool2)
else else
{ {
/* merge is unnecessary */ /* merge is unnecessary */
while (bti = (BTItem) tuplesort_getindextuple(btspool->sortstate, true, &should_free), bti != (BTItem) NULL) while ((bti = (BTItem) tuplesort_getindextuple(btspool->sortstate,
true, &should_free)) != NULL)
{ {
/* When we see first tuple, create first index page */ /* When we see first tuple, create first index page */
if (state == NULL) if (state == NULL)
......
This diff is collapsed.
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,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/access/rtree/Attic/rtproc.c,v 1.37 2003/08/04 02:39:57 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/access/rtree/Attic/rtproc.c,v 1.38 2003/11/12 21:15:48 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -82,20 +82,6 @@ rt_box_size(PG_FUNCTION_ARGS) ...@@ -82,20 +82,6 @@ rt_box_size(PG_FUNCTION_ARGS)
PG_RETURN_VOID(); PG_RETURN_VOID();
} }
/*
* rt_bigbox_size() -- Compute a size for big boxes.
*
* In an earlier release of the system, this routine did something
* different from rt_box_size. We now use floats, rather than ints,
* as the return type for the size routine, so we no longer need to
* have a special return type for big boxes.
*/
Datum
rt_bigbox_size(PG_FUNCTION_ARGS)
{
return rt_box_size(fcinfo);
}
Datum Datum
rt_poly_union(PG_FUNCTION_ARGS) rt_poly_union(PG_FUNCTION_ARGS)
{ {
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/rtree/Attic/rtscan.c,v 1.48 2003/11/09 21:30:35 tgl Exp $ * $Header: /cvsroot/pgsql/src/backend/access/rtree/Attic/rtscan.c,v 1.49 2003/11/12 21:15:48 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -123,15 +123,17 @@ rtrescan(PG_FUNCTION_ARGS) ...@@ -123,15 +123,17 @@ rtrescan(PG_FUNCTION_ARGS)
opclass = s->indexRelation->rd_index->indclass[attno-1]; opclass = s->indexRelation->rd_index->indclass[attno-1];
int_strategy = RTMapToInternalOperator(s->keyData[i].sk_strategy); int_strategy = RTMapToInternalOperator(s->keyData[i].sk_strategy);
int_oper = get_opclass_member(opclass, int_strategy); int_oper = get_opclass_member(opclass,
s->keyData[i].sk_subtype,
int_strategy);
int_proc = get_opcode(int_oper); int_proc = get_opcode(int_oper);
ScanKeyEntryInitialize(&(p->s_internalKey[i]), ScanKeyEntryInitialize(&(p->s_internalKey[i]),
s->keyData[i].sk_flags, s->keyData[i].sk_flags,
attno, attno,
int_strategy, int_strategy,
s->keyData[i].sk_subtype,
int_proc, int_proc,
s->keyData[i].sk_argument, s->keyData[i].sk_argument);
s->keyData[i].sk_argtype);
} }
} }
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/catalog/aclchk.c,v 1.92 2003/11/09 21:30:35 tgl Exp $ * $Header: /cvsroot/pgsql/src/backend/catalog/aclchk.c,v 1.93 2003/11/12 21:15:48 tgl Exp $
* *
* NOTES * NOTES
* See acl.h. * See acl.h.
...@@ -366,10 +366,10 @@ ExecuteGrantStmt_Database(GrantStmt *stmt) ...@@ -366,10 +366,10 @@ ExecuteGrantStmt_Database(GrantStmt *stmt)
char replaces[Natts_pg_database]; char replaces[Natts_pg_database];
relation = heap_openr(DatabaseRelationName, RowExclusiveLock); relation = heap_openr(DatabaseRelationName, RowExclusiveLock);
ScanKeyEntryInitialize(&entry[0], 0, ScanKeyInit(&entry[0],
Anum_pg_database_datname, Anum_pg_database_datname,
BTEqualStrategyNumber, F_NAMEEQ, BTEqualStrategyNumber, F_NAMEEQ,
CStringGetDatum(dbname), NAMEOID); CStringGetDatum(dbname));
scan = heap_beginscan(relation, SnapshotNow, 1, entry); scan = heap_beginscan(relation, SnapshotNow, 1, entry);
tuple = heap_getnext(scan, ForwardScanDirection); tuple = heap_getnext(scan, ForwardScanDirection);
if (!HeapTupleIsValid(tuple)) if (!HeapTupleIsValid(tuple))
...@@ -1131,10 +1131,10 @@ pg_database_aclcheck(Oid db_oid, AclId userid, AclMode mode) ...@@ -1131,10 +1131,10 @@ pg_database_aclcheck(Oid db_oid, AclId userid, AclMode mode)
* There's no syscache for pg_database, so must look the hard way * There's no syscache for pg_database, so must look the hard way
*/ */
pg_database = heap_openr(DatabaseRelationName, AccessShareLock); pg_database = heap_openr(DatabaseRelationName, AccessShareLock);
ScanKeyEntryInitialize(&entry[0], 0, ScanKeyInit(&entry[0],
ObjectIdAttributeNumber, ObjectIdAttributeNumber,
BTEqualStrategyNumber, F_OIDEQ, BTEqualStrategyNumber, F_OIDEQ,
ObjectIdGetDatum(db_oid), OIDOID); ObjectIdGetDatum(db_oid));
scan = heap_beginscan(pg_database, SnapshotNow, 1, entry); scan = heap_beginscan(pg_database, SnapshotNow, 1, entry);
tuple = heap_getnext(scan, ForwardScanDirection); tuple = heap_getnext(scan, ForwardScanDirection);
if (!HeapTupleIsValid(tuple)) if (!HeapTupleIsValid(tuple))
...@@ -1531,10 +1531,10 @@ pg_database_ownercheck(Oid db_oid, AclId userid) ...@@ -1531,10 +1531,10 @@ pg_database_ownercheck(Oid db_oid, AclId userid)
/* There's no syscache for pg_database, so must look the hard way */ /* There's no syscache for pg_database, so must look the hard way */
pg_database = heap_openr(DatabaseRelationName, AccessShareLock); pg_database = heap_openr(DatabaseRelationName, AccessShareLock);
ScanKeyEntryInitialize(&entry[0], 0, ScanKeyInit(&entry[0],
ObjectIdAttributeNumber, ObjectIdAttributeNumber,
BTEqualStrategyNumber, F_OIDEQ, BTEqualStrategyNumber, F_OIDEQ,
ObjectIdGetDatum(db_oid), OIDOID); ObjectIdGetDatum(db_oid));
scan = heap_beginscan(pg_database, SnapshotNow, 1, entry); scan = heap_beginscan(pg_database, SnapshotNow, 1, entry);
dbtuple = heap_getnext(scan, ForwardScanDirection); dbtuple = heap_getnext(scan, ForwardScanDirection);
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,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/catalog/dependency.c,v 1.32 2003/11/09 21:30:35 tgl Exp $ * $Header: /cvsroot/pgsql/src/backend/catalog/dependency.c,v 1.33 2003/11/12 21:15:48 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -31,7 +31,6 @@ ...@@ -31,7 +31,6 @@
#include "catalog/pg_opclass.h" #include "catalog/pg_opclass.h"
#include "catalog/pg_rewrite.h" #include "catalog/pg_rewrite.h"
#include "catalog/pg_trigger.h" #include "catalog/pg_trigger.h"
#include "catalog/pg_type.h"
#include "commands/comment.h" #include "commands/comment.h"
#include "commands/defrem.h" #include "commands/defrem.h"
#include "commands/proclang.h" #include "commands/proclang.h"
...@@ -283,20 +282,20 @@ findAutoDeletableObjects(const ObjectAddress *object, ...@@ -283,20 +282,20 @@ findAutoDeletableObjects(const ObjectAddress *object,
* When dropping a whole object (subId = 0), find pg_depend records for * When dropping a whole object (subId = 0), find pg_depend records for
* its sub-objects too. * its sub-objects too.
*/ */
ScanKeyEntryInitialize(&key[0], 0, ScanKeyInit(&key[0],
Anum_pg_depend_refclassid, Anum_pg_depend_refclassid,
BTEqualStrategyNumber, F_OIDEQ, BTEqualStrategyNumber, F_OIDEQ,
ObjectIdGetDatum(object->classId), OIDOID); ObjectIdGetDatum(object->classId));
ScanKeyEntryInitialize(&key[1], 0, ScanKeyInit(&key[1],
Anum_pg_depend_refobjid, Anum_pg_depend_refobjid,
BTEqualStrategyNumber, F_OIDEQ, BTEqualStrategyNumber, F_OIDEQ,
ObjectIdGetDatum(object->objectId), OIDOID); ObjectIdGetDatum(object->objectId));
if (object->objectSubId != 0) if (object->objectSubId != 0)
{ {
ScanKeyEntryInitialize(&key[2], 0, ScanKeyInit(&key[2],
Anum_pg_depend_refobjsubid, Anum_pg_depend_refobjsubid,
BTEqualStrategyNumber, F_INT4EQ, BTEqualStrategyNumber, F_INT4EQ,
Int32GetDatum(object->objectSubId), INT4OID); Int32GetDatum(object->objectSubId));
nkeys = 3; nkeys = 3;
} }
else else
...@@ -418,20 +417,20 @@ recursiveDeletion(const ObjectAddress *object, ...@@ -418,20 +417,20 @@ recursiveDeletion(const ObjectAddress *object,
* When dropping a whole object (subId = 0), remove all pg_depend records * When dropping a whole object (subId = 0), remove all pg_depend records
* for its sub-objects too. * for its sub-objects too.
*/ */
ScanKeyEntryInitialize(&key[0], 0, ScanKeyInit(&key[0],
Anum_pg_depend_classid, Anum_pg_depend_classid,
BTEqualStrategyNumber, F_OIDEQ, BTEqualStrategyNumber, F_OIDEQ,
ObjectIdGetDatum(object->classId), OIDOID); ObjectIdGetDatum(object->classId));
ScanKeyEntryInitialize(&key[1], 0, ScanKeyInit(&key[1],
Anum_pg_depend_objid, Anum_pg_depend_objid,
BTEqualStrategyNumber, F_OIDEQ, BTEqualStrategyNumber, F_OIDEQ,
ObjectIdGetDatum(object->objectId), OIDOID); ObjectIdGetDatum(object->objectId));
if (object->objectSubId != 0) if (object->objectSubId != 0)
{ {
ScanKeyEntryInitialize(&key[2], 0, ScanKeyInit(&key[2],
Anum_pg_depend_objsubid, Anum_pg_depend_objsubid,
BTEqualStrategyNumber, F_INT4EQ, BTEqualStrategyNumber, F_INT4EQ,
Int32GetDatum(object->objectSubId), INT4OID); Int32GetDatum(object->objectSubId));
nkeys = 3; nkeys = 3;
} }
else else
...@@ -651,20 +650,20 @@ deleteDependentObjects(const ObjectAddress *object, ...@@ -651,20 +650,20 @@ deleteDependentObjects(const ObjectAddress *object,
HeapTuple tup; HeapTuple tup;
ObjectAddress otherObject; ObjectAddress otherObject;
ScanKeyEntryInitialize(&key[0], 0, ScanKeyInit(&key[0],
Anum_pg_depend_refclassid, Anum_pg_depend_refclassid,
BTEqualStrategyNumber, F_OIDEQ, BTEqualStrategyNumber, F_OIDEQ,
ObjectIdGetDatum(object->classId), OIDOID); ObjectIdGetDatum(object->classId));
ScanKeyEntryInitialize(&key[1], 0, ScanKeyInit(&key[1],
Anum_pg_depend_refobjid, Anum_pg_depend_refobjid,
BTEqualStrategyNumber, F_OIDEQ, BTEqualStrategyNumber, F_OIDEQ,
ObjectIdGetDatum(object->objectId), OIDOID); ObjectIdGetDatum(object->objectId));
if (object->objectSubId != 0) if (object->objectSubId != 0)
{ {
ScanKeyEntryInitialize(&key[2], 0, ScanKeyInit(&key[2],
Anum_pg_depend_refobjsubid, Anum_pg_depend_refobjsubid,
BTEqualStrategyNumber, F_INT4EQ, BTEqualStrategyNumber, F_INT4EQ,
Int32GetDatum(object->objectSubId), INT4OID); Int32GetDatum(object->objectSubId));
nkeys = 3; nkeys = 3;
} }
else else
...@@ -1473,11 +1472,10 @@ getObjectDescription(const ObjectAddress *object) ...@@ -1473,11 +1472,10 @@ getObjectDescription(const ObjectAddress *object)
castDesc = heap_openr(CastRelationName, AccessShareLock); castDesc = heap_openr(CastRelationName, AccessShareLock);
ScanKeyEntryInitialize(&skey[0], 0, ScanKeyInit(&skey[0],
ObjectIdAttributeNumber, ObjectIdAttributeNumber,
BTEqualStrategyNumber, F_OIDEQ, BTEqualStrategyNumber, F_OIDEQ,
ObjectIdGetDatum(object->objectId), ObjectIdGetDatum(object->objectId));
OIDOID);
rcscan = systable_beginscan(castDesc, CastOidIndex, true, rcscan = systable_beginscan(castDesc, CastOidIndex, true,
SnapshotNow, 1, skey); SnapshotNow, 1, skey);
...@@ -1509,11 +1507,10 @@ getObjectDescription(const ObjectAddress *object) ...@@ -1509,11 +1507,10 @@ getObjectDescription(const ObjectAddress *object)
conDesc = heap_openr(ConstraintRelationName, AccessShareLock); conDesc = heap_openr(ConstraintRelationName, AccessShareLock);
ScanKeyEntryInitialize(&skey[0], 0, ScanKeyInit(&skey[0],
ObjectIdAttributeNumber, ObjectIdAttributeNumber,
BTEqualStrategyNumber, F_OIDEQ, BTEqualStrategyNumber, F_OIDEQ,
ObjectIdGetDatum(object->objectId), ObjectIdGetDatum(object->objectId));
OIDOID);
rcscan = systable_beginscan(conDesc, ConstraintOidIndex, true, rcscan = systable_beginscan(conDesc, ConstraintOidIndex, true,
SnapshotNow, 1, skey); SnapshotNow, 1, skey);
...@@ -1570,11 +1567,10 @@ getObjectDescription(const ObjectAddress *object) ...@@ -1570,11 +1567,10 @@ getObjectDescription(const ObjectAddress *object)
attrdefDesc = heap_openr(AttrDefaultRelationName, AccessShareLock); attrdefDesc = heap_openr(AttrDefaultRelationName, AccessShareLock);
ScanKeyEntryInitialize(&skey[0], 0, ScanKeyInit(&skey[0],
ObjectIdAttributeNumber, ObjectIdAttributeNumber,
BTEqualStrategyNumber, F_OIDEQ, BTEqualStrategyNumber, F_OIDEQ,
ObjectIdGetDatum(object->objectId), ObjectIdGetDatum(object->objectId));
OIDOID);
adscan = systable_beginscan(attrdefDesc, AttrDefaultOidIndex, adscan = systable_beginscan(attrdefDesc, AttrDefaultOidIndex,
true, SnapshotNow, 1, skey); true, SnapshotNow, 1, skey);
...@@ -1672,11 +1668,10 @@ getObjectDescription(const ObjectAddress *object) ...@@ -1672,11 +1668,10 @@ getObjectDescription(const ObjectAddress *object)
ruleDesc = heap_openr(RewriteRelationName, AccessShareLock); ruleDesc = heap_openr(RewriteRelationName, AccessShareLock);
ScanKeyEntryInitialize(&skey[0], 0, ScanKeyInit(&skey[0],
ObjectIdAttributeNumber, ObjectIdAttributeNumber,
BTEqualStrategyNumber, F_OIDEQ, BTEqualStrategyNumber, F_OIDEQ,
ObjectIdGetDatum(object->objectId), ObjectIdGetDatum(object->objectId));
OIDOID);
rcscan = systable_beginscan(ruleDesc, RewriteOidIndex, true, rcscan = systable_beginscan(ruleDesc, RewriteOidIndex, true,
SnapshotNow, 1, skey); SnapshotNow, 1, skey);
...@@ -1708,11 +1703,10 @@ getObjectDescription(const ObjectAddress *object) ...@@ -1708,11 +1703,10 @@ getObjectDescription(const ObjectAddress *object)
trigDesc = heap_openr(TriggerRelationName, AccessShareLock); trigDesc = heap_openr(TriggerRelationName, AccessShareLock);
ScanKeyEntryInitialize(&skey[0], 0, ScanKeyInit(&skey[0],
ObjectIdAttributeNumber, ObjectIdAttributeNumber,
BTEqualStrategyNumber, F_OIDEQ, BTEqualStrategyNumber, F_OIDEQ,
ObjectIdGetDatum(object->objectId), ObjectIdGetDatum(object->objectId));
OIDOID);
tgscan = systable_beginscan(trigDesc, TriggerOidIndex, true, tgscan = systable_beginscan(trigDesc, TriggerOidIndex, true,
SnapshotNow, 1, skey); SnapshotNow, 1, skey);
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/catalog/heap.c,v 1.254 2003/11/09 21:30:36 tgl Exp $ * $Header: /cvsroot/pgsql/src/backend/catalog/heap.c,v 1.255 2003/11/12 21:15:48 tgl Exp $
* *
* *
* INTERFACE ROUTINES * INTERFACE ROUTINES
...@@ -853,11 +853,10 @@ RelationRemoveInheritance(Relation relation) ...@@ -853,11 +853,10 @@ RelationRemoveInheritance(Relation relation)
catalogRelation = heap_openr(InheritsRelationName, RowExclusiveLock); catalogRelation = heap_openr(InheritsRelationName, RowExclusiveLock);
ScanKeyEntryInitialize(&key, 0, ScanKeyInit(&key,
Anum_pg_inherits_inhrelid, Anum_pg_inherits_inhrelid,
BTEqualStrategyNumber, F_OIDEQ, BTEqualStrategyNumber, F_OIDEQ,
ObjectIdGetDatum(RelationGetRelid(relation)), ObjectIdGetDatum(RelationGetRelid(relation)));
OIDOID);
scan = systable_beginscan(catalogRelation, InheritsRelidSeqnoIndex, true, scan = systable_beginscan(catalogRelation, InheritsRelidSeqnoIndex, true,
SnapshotNow, 1, &key); SnapshotNow, 1, &key);
...@@ -920,10 +919,10 @@ DeleteAttributeTuples(Oid relid) ...@@ -920,10 +919,10 @@ DeleteAttributeTuples(Oid relid)
attrel = heap_openr(AttributeRelationName, RowExclusiveLock); attrel = heap_openr(AttributeRelationName, RowExclusiveLock);
/* Use the index to scan only attributes of the target relation */ /* Use the index to scan only attributes of the target relation */
ScanKeyEntryInitialize(&key[0], 0, ScanKeyInit(&key[0],
Anum_pg_attribute_attrelid, Anum_pg_attribute_attrelid,
BTEqualStrategyNumber, F_OIDEQ, BTEqualStrategyNumber, F_OIDEQ,
ObjectIdGetDatum(relid), OIDOID); ObjectIdGetDatum(relid));
scan = systable_beginscan(attrel, AttributeRelidNumIndex, true, scan = systable_beginscan(attrel, AttributeRelidNumIndex, true,
SnapshotNow, 1, key); SnapshotNow, 1, key);
...@@ -1035,14 +1034,14 @@ RemoveAttrDefault(Oid relid, AttrNumber attnum, ...@@ -1035,14 +1034,14 @@ RemoveAttrDefault(Oid relid, AttrNumber attnum,
attrdef_rel = heap_openr(AttrDefaultRelationName, RowExclusiveLock); attrdef_rel = heap_openr(AttrDefaultRelationName, RowExclusiveLock);
ScanKeyEntryInitialize(&scankeys[0], 0, ScanKeyInit(&scankeys[0],
Anum_pg_attrdef_adrelid, Anum_pg_attrdef_adrelid,
BTEqualStrategyNumber, F_OIDEQ, BTEqualStrategyNumber, F_OIDEQ,
ObjectIdGetDatum(relid), OIDOID); ObjectIdGetDatum(relid));
ScanKeyEntryInitialize(&scankeys[1], 0, ScanKeyInit(&scankeys[1],
Anum_pg_attrdef_adnum, Anum_pg_attrdef_adnum,
BTEqualStrategyNumber, F_INT2EQ, BTEqualStrategyNumber, F_INT2EQ,
Int16GetDatum(attnum), INT2OID); Int16GetDatum(attnum));
scan = systable_beginscan(attrdef_rel, AttrDefaultIndex, true, scan = systable_beginscan(attrdef_rel, AttrDefaultIndex, true,
SnapshotNow, 2, scankeys); SnapshotNow, 2, scankeys);
...@@ -1092,10 +1091,10 @@ RemoveAttrDefaultById(Oid attrdefId) ...@@ -1092,10 +1091,10 @@ RemoveAttrDefaultById(Oid attrdefId)
attrdef_rel = heap_openr(AttrDefaultRelationName, RowExclusiveLock); attrdef_rel = heap_openr(AttrDefaultRelationName, RowExclusiveLock);
/* Find the pg_attrdef tuple */ /* Find the pg_attrdef tuple */
ScanKeyEntryInitialize(&scankeys[0], 0, ScanKeyInit(&scankeys[0],
ObjectIdAttributeNumber, ObjectIdAttributeNumber,
BTEqualStrategyNumber, F_OIDEQ, BTEqualStrategyNumber, F_OIDEQ,
ObjectIdGetDatum(attrdefId), OIDOID); ObjectIdGetDatum(attrdefId));
scan = systable_beginscan(attrdef_rel, AttrDefaultOidIndex, true, scan = systable_beginscan(attrdef_rel, AttrDefaultOidIndex, true,
SnapshotNow, 1, scankeys); SnapshotNow, 1, scankeys);
...@@ -1829,10 +1828,10 @@ RemoveRelConstraints(Relation rel, const char *constrName, ...@@ -1829,10 +1828,10 @@ RemoveRelConstraints(Relation rel, const char *constrName,
conrel = heap_openr(ConstraintRelationName, RowExclusiveLock); conrel = heap_openr(ConstraintRelationName, RowExclusiveLock);
/* Use the index to scan only constraints of the target relation */ /* Use the index to scan only constraints of the target relation */
ScanKeyEntryInitialize(&key[0], 0, ScanKeyInit(&key[0],
Anum_pg_constraint_conrelid, Anum_pg_constraint_conrelid,
BTEqualStrategyNumber, F_OIDEQ, BTEqualStrategyNumber, F_OIDEQ,
ObjectIdGetDatum(RelationGetRelid(rel)), OIDOID); ObjectIdGetDatum(RelationGetRelid(rel)));
conscan = systable_beginscan(conrel, ConstraintRelidIndex, true, conscan = systable_beginscan(conrel, ConstraintRelidIndex, true,
SnapshotNow, 1, key); SnapshotNow, 1, key);
...@@ -1883,19 +1882,19 @@ RemoveStatistics(Relation rel, AttrNumber attnum) ...@@ -1883,19 +1882,19 @@ RemoveStatistics(Relation rel, AttrNumber attnum)
pgstatistic = heap_openr(StatisticRelationName, RowExclusiveLock); pgstatistic = heap_openr(StatisticRelationName, RowExclusiveLock);
ScanKeyEntryInitialize(&key[0], 0, ScanKeyInit(&key[0],
Anum_pg_statistic_starelid, Anum_pg_statistic_starelid,
BTEqualStrategyNumber, F_OIDEQ, BTEqualStrategyNumber, F_OIDEQ,
ObjectIdGetDatum(RelationGetRelid(rel)), OIDOID); ObjectIdGetDatum(RelationGetRelid(rel)));
if (attnum == 0) if (attnum == 0)
nkeys = 1; nkeys = 1;
else else
{ {
ScanKeyEntryInitialize(&key[1], 0, ScanKeyInit(&key[1],
Anum_pg_statistic_staattnum, Anum_pg_statistic_staattnum,
BTEqualStrategyNumber, F_INT2EQ, BTEqualStrategyNumber, F_INT2EQ,
Int16GetDatum(attnum), INT2OID); Int16GetDatum(attnum));
nkeys = 2; nkeys = 2;
} }
...@@ -2050,10 +2049,10 @@ heap_truncate_check_FKs(Relation rel) ...@@ -2050,10 +2049,10 @@ heap_truncate_check_FKs(Relation rel)
*/ */
fkeyRel = heap_openr(ConstraintRelationName, AccessShareLock); fkeyRel = heap_openr(ConstraintRelationName, AccessShareLock);
ScanKeyEntryInitialize(&key, 0, ScanKeyInit(&key,
Anum_pg_constraint_confrelid, Anum_pg_constraint_confrelid,
BTEqualStrategyNumber, F_OIDEQ, BTEqualStrategyNumber, F_OIDEQ,
ObjectIdGetDatum(relid), OIDOID); ObjectIdGetDatum(relid));
fkeyScan = systable_beginscan(fkeyRel, NULL, false, fkeyScan = systable_beginscan(fkeyRel, NULL, false,
SnapshotNow, 1, &key); SnapshotNow, 1, &key);
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/catalog/index.c,v 1.220 2003/11/09 21:30:36 tgl Exp $ * $Header: /cvsroot/pgsql/src/backend/catalog/index.c,v 1.221 2003/11/12 21:15:48 tgl Exp $
* *
* *
* INTERFACE ROUTINES * INTERFACE ROUTINES
...@@ -992,10 +992,10 @@ setRelhasindex(Oid relid, bool hasindex, bool isprimary, Oid reltoastidxid) ...@@ -992,10 +992,10 @@ setRelhasindex(Oid relid, bool hasindex, bool isprimary, Oid reltoastidxid)
{ {
ScanKeyData key[1]; ScanKeyData key[1];
ScanKeyEntryInitialize(&key[0], 0, ScanKeyInit(&key[0],
ObjectIdAttributeNumber, ObjectIdAttributeNumber,
BTEqualStrategyNumber, F_OIDEQ, BTEqualStrategyNumber, F_OIDEQ,
ObjectIdGetDatum(relid), OIDOID); ObjectIdGetDatum(relid));
pg_class_scan = heap_beginscan(pg_class, SnapshotNow, 1, key); pg_class_scan = heap_beginscan(pg_class, SnapshotNow, 1, key);
tuple = heap_getnext(pg_class_scan, ForwardScanDirection); tuple = heap_getnext(pg_class_scan, ForwardScanDirection);
...@@ -1195,10 +1195,10 @@ UpdateStats(Oid relid, double reltuples) ...@@ -1195,10 +1195,10 @@ UpdateStats(Oid relid, double reltuples)
{ {
ScanKeyData key[1]; ScanKeyData key[1];
ScanKeyEntryInitialize(&key[0], 0, ScanKeyInit(&key[0],
ObjectIdAttributeNumber, ObjectIdAttributeNumber,
BTEqualStrategyNumber, F_OIDEQ, BTEqualStrategyNumber, F_OIDEQ,
ObjectIdGetDatum(relid), OIDOID); ObjectIdGetDatum(relid));
pg_class_scan = heap_beginscan(pg_class, SnapshotNow, 1, key); pg_class_scan = heap_beginscan(pg_class, SnapshotNow, 1, key);
tuple = heap_getnext(pg_class_scan, ForwardScanDirection); tuple = heap_getnext(pg_class_scan, ForwardScanDirection);
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/catalog/pg_constraint.c,v 1.17 2003/11/09 21:30:36 tgl Exp $ * $Header: /cvsroot/pgsql/src/backend/catalog/pg_constraint.c,v 1.18 2003/11/12 21:15:48 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -281,15 +281,15 @@ ConstraintNameIsUsed(CONSTRAINTCATEGORY conCat, Oid objId, Oid objNamespace, con ...@@ -281,15 +281,15 @@ ConstraintNameIsUsed(CONSTRAINTCATEGORY conCat, Oid objId, Oid objNamespace, con
found = false; found = false;
ScanKeyEntryInitialize(&skey[0], 0, ScanKeyInit(&skey[0],
Anum_pg_constraint_conname, Anum_pg_constraint_conname,
BTEqualStrategyNumber, F_NAMEEQ, BTEqualStrategyNumber, F_NAMEEQ,
CStringGetDatum(cname), NAMEOID); CStringGetDatum(cname));
ScanKeyEntryInitialize(&skey[1], 0, ScanKeyInit(&skey[1],
Anum_pg_constraint_connamespace, Anum_pg_constraint_connamespace,
BTEqualStrategyNumber, F_OIDEQ, BTEqualStrategyNumber, F_OIDEQ,
ObjectIdGetDatum(objNamespace), OIDOID); ObjectIdGetDatum(objNamespace));
conscan = systable_beginscan(conDesc, ConstraintNameNspIndex, true, conscan = systable_beginscan(conDesc, ConstraintNameNspIndex, true,
SnapshotNow, 2, skey); SnapshotNow, 2, skey);
...@@ -355,15 +355,15 @@ GenerateConstraintName(CONSTRAINTCATEGORY conCat, Oid objId, Oid objNamespace, i ...@@ -355,15 +355,15 @@ GenerateConstraintName(CONSTRAINTCATEGORY conCat, Oid objId, Oid objNamespace, i
*/ */
found = false; found = false;
ScanKeyEntryInitialize(&skey[0], 0, ScanKeyInit(&skey[0],
Anum_pg_constraint_conname, Anum_pg_constraint_conname,
BTEqualStrategyNumber, F_NAMEEQ, BTEqualStrategyNumber, F_NAMEEQ,
CStringGetDatum(cname), NAMEOID); CStringGetDatum(cname));
ScanKeyEntryInitialize(&skey[1], 0, ScanKeyInit(&skey[1],
Anum_pg_constraint_connamespace, Anum_pg_constraint_connamespace,
BTEqualStrategyNumber, F_OIDEQ, BTEqualStrategyNumber, F_OIDEQ,
ObjectIdGetDatum(objNamespace), OIDOID); ObjectIdGetDatum(objNamespace));
conscan = systable_beginscan(conDesc, ConstraintNameNspIndex, true, conscan = systable_beginscan(conDesc, ConstraintNameNspIndex, true,
SnapshotNow, 2, skey); SnapshotNow, 2, skey);
...@@ -422,10 +422,10 @@ RemoveConstraintById(Oid conId) ...@@ -422,10 +422,10 @@ RemoveConstraintById(Oid conId)
conDesc = heap_openr(ConstraintRelationName, RowExclusiveLock); conDesc = heap_openr(ConstraintRelationName, RowExclusiveLock);
ScanKeyEntryInitialize(&skey[0], 0, ScanKeyInit(&skey[0],
ObjectIdAttributeNumber, ObjectIdAttributeNumber,
BTEqualStrategyNumber, F_OIDEQ, BTEqualStrategyNumber, F_OIDEQ,
ObjectIdGetDatum(conId), OIDOID); ObjectIdGetDatum(conId));
conscan = systable_beginscan(conDesc, ConstraintOidIndex, true, conscan = systable_beginscan(conDesc, ConstraintOidIndex, true,
SnapshotNow, 1, skey); SnapshotNow, 1, skey);
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/catalog/pg_conversion.c,v 1.16 2003/11/09 21:30:36 tgl Exp $ * $Header: /cvsroot/pgsql/src/backend/catalog/pg_conversion.c,v 1.17 2003/11/12 21:15:48 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -21,7 +21,6 @@ ...@@ -21,7 +21,6 @@
#include "catalog/pg_class.h" #include "catalog/pg_class.h"
#include "catalog/pg_conversion.h" #include "catalog/pg_conversion.h"
#include "catalog/namespace.h" #include "catalog/namespace.h"
#include "catalog/pg_type.h"
#include "utils/builtins.h" #include "utils/builtins.h"
#include "utils/lsyscache.h" #include "utils/lsyscache.h"
#include "utils/syscache.h" #include "utils/syscache.h"
...@@ -177,10 +176,10 @@ RemoveConversionById(Oid conversionOid) ...@@ -177,10 +176,10 @@ RemoveConversionById(Oid conversionOid)
HeapScanDesc scan; HeapScanDesc scan;
ScanKeyData scanKeyData; ScanKeyData scanKeyData;
ScanKeyEntryInitialize(&scanKeyData, 0, ScanKeyInit(&scanKeyData,
ObjectIdAttributeNumber, ObjectIdAttributeNumber,
BTEqualStrategyNumber, F_OIDEQ, BTEqualStrategyNumber, F_OIDEQ,
ObjectIdGetDatum(conversionOid), OIDOID); ObjectIdGetDatum(conversionOid));
/* open pg_conversion */ /* open pg_conversion */
rel = heap_openr(ConversionRelationName, RowExclusiveLock); rel = heap_openr(ConversionRelationName, RowExclusiveLock);
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/catalog/pg_depend.c,v 1.8 2003/11/09 21:30:36 tgl Exp $ * $Header: /cvsroot/pgsql/src/backend/catalog/pg_depend.c,v 1.9 2003/11/12 21:15:48 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -20,7 +20,6 @@ ...@@ -20,7 +20,6 @@
#include "catalog/indexing.h" #include "catalog/indexing.h"
#include "catalog/dependency.h" #include "catalog/dependency.h"
#include "catalog/pg_depend.h" #include "catalog/pg_depend.h"
#include "catalog/pg_type.h"
#include "miscadmin.h" #include "miscadmin.h"
#include "utils/fmgroids.h" #include "utils/fmgroids.h"
...@@ -139,14 +138,14 @@ deleteDependencyRecordsFor(Oid classId, Oid objectId) ...@@ -139,14 +138,14 @@ deleteDependencyRecordsFor(Oid classId, Oid objectId)
depRel = heap_openr(DependRelationName, RowExclusiveLock); depRel = heap_openr(DependRelationName, RowExclusiveLock);
ScanKeyEntryInitialize(&key[0], 0, ScanKeyInit(&key[0],
Anum_pg_depend_classid, Anum_pg_depend_classid,
BTEqualStrategyNumber, F_OIDEQ, BTEqualStrategyNumber, F_OIDEQ,
ObjectIdGetDatum(classId), OIDOID); ObjectIdGetDatum(classId));
ScanKeyEntryInitialize(&key[1], 0, ScanKeyInit(&key[1],
Anum_pg_depend_objid, Anum_pg_depend_objid,
BTEqualStrategyNumber, F_OIDEQ, BTEqualStrategyNumber, F_OIDEQ,
ObjectIdGetDatum(objectId), OIDOID); ObjectIdGetDatum(objectId));
scan = systable_beginscan(depRel, DependDependerIndex, true, scan = systable_beginscan(depRel, DependDependerIndex, true,
SnapshotNow, 2, key); SnapshotNow, 2, key);
...@@ -181,15 +180,15 @@ isObjectPinned(const ObjectAddress *object, Relation rel) ...@@ -181,15 +180,15 @@ isObjectPinned(const ObjectAddress *object, Relation rel)
HeapTuple tup; HeapTuple tup;
ScanKeyData key[2]; ScanKeyData key[2];
ScanKeyEntryInitialize(&key[0], 0, ScanKeyInit(&key[0],
Anum_pg_depend_refclassid, Anum_pg_depend_refclassid,
BTEqualStrategyNumber, F_OIDEQ, BTEqualStrategyNumber, F_OIDEQ,
ObjectIdGetDatum(object->classId), OIDOID); ObjectIdGetDatum(object->classId));
ScanKeyEntryInitialize(&key[1], 0, ScanKeyInit(&key[1],
Anum_pg_depend_refobjid, Anum_pg_depend_refobjid,
BTEqualStrategyNumber, F_OIDEQ, BTEqualStrategyNumber, F_OIDEQ,
ObjectIdGetDatum(object->objectId), OIDOID); ObjectIdGetDatum(object->objectId));
scan = systable_beginscan(rel, DependReferenceIndex, true, scan = systable_beginscan(rel, DependReferenceIndex, true,
SnapshotNow, 2, key); SnapshotNow, 2, key);
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/catalog/pg_largeobject.c,v 1.18 2003/11/09 21:30:36 tgl Exp $ * $Header: /cvsroot/pgsql/src/backend/catalog/pg_largeobject.c,v 1.19 2003/11/12 21:15:48 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -19,7 +19,6 @@ ...@@ -19,7 +19,6 @@
#include "catalog/catname.h" #include "catalog/catname.h"
#include "catalog/indexing.h" #include "catalog/indexing.h"
#include "catalog/pg_largeobject.h" #include "catalog/pg_largeobject.h"
#include "catalog/pg_type.h"
#include "miscadmin.h" #include "miscadmin.h"
#include "utils/builtins.h" #include "utils/builtins.h"
#include "utils/fmgroids.h" #include "utils/fmgroids.h"
...@@ -82,10 +81,10 @@ LargeObjectDrop(Oid loid) ...@@ -82,10 +81,10 @@ LargeObjectDrop(Oid loid)
SysScanDesc sd; SysScanDesc sd;
HeapTuple tuple; HeapTuple tuple;
ScanKeyEntryInitialize(&skey[0], 0, ScanKeyInit(&skey[0],
Anum_pg_largeobject_loid, Anum_pg_largeobject_loid,
BTEqualStrategyNumber, F_OIDEQ, BTEqualStrategyNumber, F_OIDEQ,
ObjectIdGetDatum(loid), OIDOID); ObjectIdGetDatum(loid));
pg_largeobject = heap_openr(LargeObjectRelationName, RowExclusiveLock); pg_largeobject = heap_openr(LargeObjectRelationName, RowExclusiveLock);
...@@ -120,10 +119,10 @@ LargeObjectExists(Oid loid) ...@@ -120,10 +119,10 @@ LargeObjectExists(Oid loid)
/* /*
* See if we can find any tuples belonging to the specified LO * See if we can find any tuples belonging to the specified LO
*/ */
ScanKeyEntryInitialize(&skey[0], 0, ScanKeyInit(&skey[0],
Anum_pg_largeobject_loid, Anum_pg_largeobject_loid,
BTEqualStrategyNumber, F_OIDEQ, BTEqualStrategyNumber, F_OIDEQ,
ObjectIdGetDatum(loid), OIDOID); ObjectIdGetDatum(loid));
pg_largeobject = heap_openr(LargeObjectRelationName, AccessShareLock); pg_largeobject = heap_openr(LargeObjectRelationName, AccessShareLock);
......
...@@ -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/async.c,v 1.103 2003/11/09 21:30:36 tgl Exp $ * $Header: /cvsroot/pgsql/src/backend/commands/async.c,v 1.104 2003/11/12 21:15:49 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -80,7 +80,6 @@ ...@@ -80,7 +80,6 @@
#include "access/heapam.h" #include "access/heapam.h"
#include "catalog/catname.h" #include "catalog/catname.h"
#include "catalog/pg_listener.h" #include "catalog/pg_listener.h"
#include "catalog/pg_type.h"
#include "commands/async.h" #include "commands/async.h"
#include "libpq/libpq.h" #include "libpq/libpq.h"
#include "libpq/pqformat.h" #include "libpq/pqformat.h"
...@@ -353,10 +352,10 @@ Async_UnlistenAll(void) ...@@ -353,10 +352,10 @@ Async_UnlistenAll(void)
tdesc = RelationGetDescr(lRel); tdesc = RelationGetDescr(lRel);
/* Find and delete all entries with my listenerPID */ /* Find and delete all entries with my listenerPID */
ScanKeyEntryInitialize(&key[0], 0, ScanKeyInit(&key[0],
Anum_pg_listener_pid, Anum_pg_listener_pid,
BTEqualStrategyNumber, F_INT4EQ, BTEqualStrategyNumber, F_INT4EQ,
Int32GetDatum(MyProcPid), INT4OID); Int32GetDatum(MyProcPid));
scan = heap_beginscan(lRel, SnapshotNow, 1, key); scan = heap_beginscan(lRel, SnapshotNow, 1, key);
while ((lTuple = heap_getnext(scan, ForwardScanDirection)) != NULL) while ((lTuple = heap_getnext(scan, ForwardScanDirection)) != NULL)
...@@ -817,10 +816,10 @@ ProcessIncomingNotify(void) ...@@ -817,10 +816,10 @@ ProcessIncomingNotify(void)
tdesc = RelationGetDescr(lRel); tdesc = RelationGetDescr(lRel);
/* Scan only entries with my listenerPID */ /* Scan only entries with my listenerPID */
ScanKeyEntryInitialize(&key[0], 0, ScanKeyInit(&key[0],
Anum_pg_listener_pid, Anum_pg_listener_pid,
BTEqualStrategyNumber, F_INT4EQ, BTEqualStrategyNumber, F_INT4EQ,
Int32GetDatum(MyProcPid), INT4OID); Int32GetDatum(MyProcPid));
scan = heap_beginscan(lRel, SnapshotNow, 1, key); scan = heap_beginscan(lRel, SnapshotNow, 1, key);
/* Prepare data for rewriting 0 into notification field */ /* Prepare data for rewriting 0 into notification field */
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/commands/cluster.c,v 1.117 2003/11/09 21:30:36 tgl Exp $ * $Header: /cvsroot/pgsql/src/backend/commands/cluster.c,v 1.118 2003/11/12 21:15:49 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -26,7 +26,6 @@ ...@@ -26,7 +26,6 @@
#include "catalog/index.h" #include "catalog/index.h"
#include "catalog/indexing.h" #include "catalog/indexing.h"
#include "catalog/namespace.h" #include "catalog/namespace.h"
#include "catalog/pg_type.h"
#include "commands/cluster.h" #include "commands/cluster.h"
#include "commands/tablecmds.h" #include "commands/tablecmds.h"
#include "miscadmin.h" #include "miscadmin.h"
...@@ -879,10 +878,10 @@ get_tables_to_cluster(MemoryContext cluster_context) ...@@ -879,10 +878,10 @@ get_tables_to_cluster(MemoryContext cluster_context)
* when called with one of them as argument. * when called with one of them as argument.
*/ */
indRelation = relation_openr(IndexRelationName, AccessShareLock); indRelation = relation_openr(IndexRelationName, AccessShareLock);
ScanKeyEntryInitialize(&entry, 0, ScanKeyInit(&entry,
Anum_pg_index_indisclustered, Anum_pg_index_indisclustered,
BTEqualStrategyNumber, F_BOOLEQ, BTEqualStrategyNumber, F_BOOLEQ,
BoolGetDatum(true), BOOLOID); BoolGetDatum(true));
scan = heap_beginscan(indRelation, SnapshotNow, 1, &entry); scan = heap_beginscan(indRelation, SnapshotNow, 1, &entry);
while ((indexTuple = heap_getnext(scan, ForwardScanDirection)) != NULL) while ((indexTuple = heap_getnext(scan, ForwardScanDirection)) != NULL)
{ {
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* Copyright (c) 1996-2003, PostgreSQL Global Development Group * Copyright (c) 1996-2003, PostgreSQL Global Development Group
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/commands/comment.c,v 1.72 2003/11/09 21:30:36 tgl Exp $ * $Header: /cvsroot/pgsql/src/backend/commands/comment.c,v 1.73 2003/11/12 21:15:49 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -156,18 +156,18 @@ CreateComments(Oid oid, Oid classoid, int32 subid, char *comment) ...@@ -156,18 +156,18 @@ CreateComments(Oid oid, Oid classoid, int32 subid, char *comment)
/* Use the index to search for a matching old tuple */ /* Use the index to search for a matching old tuple */
ScanKeyEntryInitialize(&skey[0], 0, ScanKeyInit(&skey[0],
Anum_pg_description_objoid, Anum_pg_description_objoid,
BTEqualStrategyNumber, F_OIDEQ, BTEqualStrategyNumber, F_OIDEQ,
ObjectIdGetDatum(oid), OIDOID); ObjectIdGetDatum(oid));
ScanKeyEntryInitialize(&skey[1], 0, ScanKeyInit(&skey[1],
Anum_pg_description_classoid, Anum_pg_description_classoid,
BTEqualStrategyNumber, F_OIDEQ, BTEqualStrategyNumber, F_OIDEQ,
ObjectIdGetDatum(classoid), OIDOID); ObjectIdGetDatum(classoid));
ScanKeyEntryInitialize(&skey[2], 0, ScanKeyInit(&skey[2],
Anum_pg_description_objsubid, Anum_pg_description_objsubid,
BTEqualStrategyNumber, F_INT4EQ, BTEqualStrategyNumber, F_INT4EQ,
Int32GetDatum(subid), INT4OID); Int32GetDatum(subid));
description = heap_openr(DescriptionRelationName, RowExclusiveLock); description = heap_openr(DescriptionRelationName, RowExclusiveLock);
...@@ -231,21 +231,21 @@ DeleteComments(Oid oid, Oid classoid, int32 subid) ...@@ -231,21 +231,21 @@ DeleteComments(Oid oid, Oid classoid, int32 subid)
/* Use the index to search for all matching old tuples */ /* Use the index to search for all matching old tuples */
ScanKeyEntryInitialize(&skey[0], 0, ScanKeyInit(&skey[0],
Anum_pg_description_objoid, Anum_pg_description_objoid,
BTEqualStrategyNumber, F_OIDEQ, BTEqualStrategyNumber, F_OIDEQ,
ObjectIdGetDatum(oid), OIDOID); ObjectIdGetDatum(oid));
ScanKeyEntryInitialize(&skey[1], 0, ScanKeyInit(&skey[1],
Anum_pg_description_classoid, Anum_pg_description_classoid,
BTEqualStrategyNumber, F_OIDEQ, BTEqualStrategyNumber, F_OIDEQ,
ObjectIdGetDatum(classoid), OIDOID); ObjectIdGetDatum(classoid));
if (subid != 0) if (subid != 0)
{ {
ScanKeyEntryInitialize(&skey[2], 0, ScanKeyInit(&skey[2],
Anum_pg_description_objsubid, Anum_pg_description_objsubid,
BTEqualStrategyNumber, F_INT4EQ, BTEqualStrategyNumber, F_INT4EQ,
Int32GetDatum(subid), INT4OID); Int32GetDatum(subid));
nkeys = 3; nkeys = 3;
} }
else else
...@@ -538,10 +538,10 @@ CommentRule(List *qualname, char *comment) ...@@ -538,10 +538,10 @@ CommentRule(List *qualname, char *comment)
rulename = strVal(lfirst(qualname)); rulename = strVal(lfirst(qualname));
/* Search pg_rewrite for such a rule */ /* Search pg_rewrite for such a rule */
ScanKeyEntryInitialize(&scanKeyData, 0, ScanKeyInit(&scanKeyData,
Anum_pg_rewrite_rulename, Anum_pg_rewrite_rulename,
BTEqualStrategyNumber, F_NAMEEQ, BTEqualStrategyNumber, F_NAMEEQ,
PointerGetDatum(rulename), NAMEOID); PointerGetDatum(rulename));
RewriteRelation = heap_openr(RewriteRelationName, AccessShareLock); RewriteRelation = heap_openr(RewriteRelationName, AccessShareLock);
scanDesc = heap_beginscan(RewriteRelation, SnapshotNow, scanDesc = heap_beginscan(RewriteRelation, SnapshotNow,
...@@ -791,15 +791,14 @@ CommentTrigger(List *qualname, char *comment) ...@@ -791,15 +791,14 @@ CommentTrigger(List *qualname, char *comment)
* because of the unique index. * because of the unique index.
*/ */
pg_trigger = heap_openr(TriggerRelationName, AccessShareLock); pg_trigger = heap_openr(TriggerRelationName, AccessShareLock);
ScanKeyEntryInitialize(&entry[0], 0, ScanKeyInit(&entry[0],
Anum_pg_trigger_tgrelid, Anum_pg_trigger_tgrelid,
BTEqualStrategyNumber, F_OIDEQ, BTEqualStrategyNumber, F_OIDEQ,
ObjectIdGetDatum(RelationGetRelid(relation)), ObjectIdGetDatum(RelationGetRelid(relation)));
OIDOID); ScanKeyInit(&entry[1],
ScanKeyEntryInitialize(&entry[1], 0, Anum_pg_trigger_tgname,
Anum_pg_trigger_tgname, BTEqualStrategyNumber, F_NAMEEQ,
BTEqualStrategyNumber, F_NAMEEQ, CStringGetDatum(trigname));
CStringGetDatum(trigname), NAMEOID);
scan = systable_beginscan(pg_trigger, TriggerRelidNameIndex, true, scan = systable_beginscan(pg_trigger, TriggerRelidNameIndex, true,
SnapshotNow, 2, entry); SnapshotNow, 2, entry);
triggertuple = systable_getnext(scan); triggertuple = systable_getnext(scan);
...@@ -872,11 +871,10 @@ CommentConstraint(List *qualname, char *comment) ...@@ -872,11 +871,10 @@ CommentConstraint(List *qualname, char *comment)
*/ */
pg_constraint = heap_openr(ConstraintRelationName, AccessShareLock); pg_constraint = heap_openr(ConstraintRelationName, AccessShareLock);
ScanKeyEntryInitialize(&skey[0], 0, ScanKeyInit(&skey[0],
Anum_pg_constraint_conrelid, Anum_pg_constraint_conrelid,
BTEqualStrategyNumber, F_OIDEQ, BTEqualStrategyNumber, F_OIDEQ,
ObjectIdGetDatum(RelationGetRelid(relation)), ObjectIdGetDatum(RelationGetRelid(relation)));
OIDOID);
scan = systable_beginscan(pg_constraint, ConstraintRelidIndex, true, scan = systable_beginscan(pg_constraint, ConstraintRelidIndex, true,
SnapshotNow, 1, skey); SnapshotNow, 1, skey);
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/commands/dbcommands.c,v 1.125 2003/11/09 21:30:36 tgl Exp $ * $Header: /cvsroot/pgsql/src/backend/commands/dbcommands.c,v 1.126 2003/11/12 21:15:50 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -27,7 +27,6 @@ ...@@ -27,7 +27,6 @@
#include "catalog/pg_database.h" #include "catalog/pg_database.h"
#include "catalog/pg_shadow.h" #include "catalog/pg_shadow.h"
#include "catalog/indexing.h" #include "catalog/indexing.h"
#include "catalog/pg_type.h"
#include "commands/comment.h" #include "commands/comment.h"
#include "commands/dbcommands.h" #include "commands/dbcommands.h"
#include "miscadmin.h" #include "miscadmin.h"
...@@ -531,10 +530,10 @@ dropdb(const char *dbname) ...@@ -531,10 +530,10 @@ dropdb(const char *dbname)
/* /*
* Find the database's tuple by OID (should be unique). * Find the database's tuple by OID (should be unique).
*/ */
ScanKeyEntryInitialize(&key, 0, ScanKeyInit(&key,
ObjectIdAttributeNumber, ObjectIdAttributeNumber,
BTEqualStrategyNumber, F_OIDEQ, BTEqualStrategyNumber, F_OIDEQ,
ObjectIdGetDatum(db_id), OIDOID); ObjectIdGetDatum(db_id));
pgdbscan = systable_beginscan(pgdbrel, DatabaseOidIndex, true, pgdbscan = systable_beginscan(pgdbrel, DatabaseOidIndex, true,
SnapshotNow, 1, &key); SnapshotNow, 1, &key);
...@@ -616,10 +615,10 @@ RenameDatabase(const char *oldname, const char *newname) ...@@ -616,10 +615,10 @@ RenameDatabase(const char *oldname, const char *newname)
*/ */
rel = heap_openr(DatabaseRelationName, AccessExclusiveLock); rel = heap_openr(DatabaseRelationName, AccessExclusiveLock);
ScanKeyEntryInitialize(&key, 0, ScanKeyInit(&key,
Anum_pg_database_datname, Anum_pg_database_datname,
BTEqualStrategyNumber, F_NAMEEQ, BTEqualStrategyNumber, F_NAMEEQ,
NameGetDatum(oldname), NAMEOID); NameGetDatum(oldname));
scan = systable_beginscan(rel, DatabaseNameIndex, true, scan = systable_beginscan(rel, DatabaseNameIndex, true,
SnapshotNow, 1, &key); SnapshotNow, 1, &key);
...@@ -651,10 +650,10 @@ RenameDatabase(const char *oldname, const char *newname) ...@@ -651,10 +650,10 @@ RenameDatabase(const char *oldname, const char *newname)
oldname))); oldname)));
/* make sure the new name doesn't exist */ /* make sure the new name doesn't exist */
ScanKeyEntryInitialize(&key2, 0, ScanKeyInit(&key2,
Anum_pg_database_datname, Anum_pg_database_datname,
BTEqualStrategyNumber, F_NAMEEQ, BTEqualStrategyNumber, F_NAMEEQ,
NameGetDatum(newname), NAMEOID); NameGetDatum(newname));
scan2 = systable_beginscan(rel, DatabaseNameIndex, true, scan2 = systable_beginscan(rel, DatabaseNameIndex, true,
SnapshotNow, 1, &key2); SnapshotNow, 1, &key2);
if (HeapTupleIsValid(systable_getnext(scan2))) if (HeapTupleIsValid(systable_getnext(scan2)))
...@@ -712,10 +711,10 @@ AlterDatabaseSet(AlterDatabaseSetStmt *stmt) ...@@ -712,10 +711,10 @@ AlterDatabaseSet(AlterDatabaseSetStmt *stmt)
valuestr = flatten_set_variable_args(stmt->variable, stmt->value); valuestr = flatten_set_variable_args(stmt->variable, stmt->value);
rel = heap_openr(DatabaseRelationName, RowExclusiveLock); rel = heap_openr(DatabaseRelationName, RowExclusiveLock);
ScanKeyEntryInitialize(&scankey, 0, ScanKeyInit(&scankey,
Anum_pg_database_datname, Anum_pg_database_datname,
BTEqualStrategyNumber, F_NAMEEQ, BTEqualStrategyNumber, F_NAMEEQ,
NameGetDatum(stmt->dbname), NAMEOID); NameGetDatum(stmt->dbname));
scan = systable_beginscan(rel, DatabaseNameIndex, true, scan = systable_beginscan(rel, DatabaseNameIndex, true,
SnapshotNow, 1, &scankey); SnapshotNow, 1, &scankey);
tuple = systable_getnext(scan); tuple = systable_getnext(scan);
...@@ -795,10 +794,10 @@ get_db_info(const char *name, Oid *dbIdP, int4 *ownerIdP, ...@@ -795,10 +794,10 @@ get_db_info(const char *name, Oid *dbIdP, int4 *ownerIdP,
/* Caller may wish to grab a better lock on pg_database beforehand... */ /* Caller may wish to grab a better lock on pg_database beforehand... */
relation = heap_openr(DatabaseRelationName, AccessShareLock); relation = heap_openr(DatabaseRelationName, AccessShareLock);
ScanKeyEntryInitialize(&scanKey, 0, ScanKeyInit(&scanKey,
Anum_pg_database_datname, Anum_pg_database_datname,
BTEqualStrategyNumber, F_NAMEEQ, BTEqualStrategyNumber, F_NAMEEQ,
NameGetDatum(name), NAMEOID); NameGetDatum(name));
scan = systable_beginscan(relation, DatabaseNameIndex, true, scan = systable_beginscan(relation, DatabaseNameIndex, true,
SnapshotNow, 1, &scanKey); SnapshotNow, 1, &scanKey);
...@@ -1001,10 +1000,10 @@ get_database_oid(const char *dbname) ...@@ -1001,10 +1000,10 @@ get_database_oid(const char *dbname)
/* There's no syscache for pg_database, so must look the hard way */ /* There's no syscache for pg_database, so must look the hard way */
pg_database = heap_openr(DatabaseRelationName, AccessShareLock); pg_database = heap_openr(DatabaseRelationName, AccessShareLock);
ScanKeyEntryInitialize(&entry[0], 0, ScanKeyInit(&entry[0],
Anum_pg_database_datname, Anum_pg_database_datname,
BTEqualStrategyNumber, F_NAMEEQ, BTEqualStrategyNumber, F_NAMEEQ,
CStringGetDatum(dbname), NAMEOID); CStringGetDatum(dbname));
scan = systable_beginscan(pg_database, DatabaseNameIndex, true, scan = systable_beginscan(pg_database, DatabaseNameIndex, true,
SnapshotNow, 1, entry); SnapshotNow, 1, entry);
...@@ -1041,10 +1040,10 @@ get_database_name(Oid dbid) ...@@ -1041,10 +1040,10 @@ get_database_name(Oid dbid)
/* There's no syscache for pg_database, so must look the hard way */ /* There's no syscache for pg_database, so must look the hard way */
pg_database = heap_openr(DatabaseRelationName, AccessShareLock); pg_database = heap_openr(DatabaseRelationName, AccessShareLock);
ScanKeyEntryInitialize(&entry[0], 0, ScanKeyInit(&entry[0],
ObjectIdAttributeNumber, ObjectIdAttributeNumber,
BTEqualStrategyNumber, F_OIDEQ, BTEqualStrategyNumber, F_OIDEQ,
ObjectIdGetDatum(dbid), OIDOID); ObjectIdGetDatum(dbid));
scan = systable_beginscan(pg_database, DatabaseOidIndex, true, scan = systable_beginscan(pg_database, DatabaseOidIndex, true,
SnapshotNow, 1, entry); SnapshotNow, 1, entry);
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/commands/functioncmds.c,v 1.39 2003/11/09 21:30:36 tgl Exp $ * $Header: /cvsroot/pgsql/src/backend/commands/functioncmds.c,v 1.40 2003/11/12 21:15:50 tgl Exp $
* *
* DESCRIPTION * DESCRIPTION
* These routines take the parse tree and pick out the * These routines take the parse tree and pick out the
...@@ -1097,10 +1097,10 @@ DropCastById(Oid castOid) ...@@ -1097,10 +1097,10 @@ DropCastById(Oid castOid)
relation = heap_openr(CastRelationName, RowExclusiveLock); relation = heap_openr(CastRelationName, RowExclusiveLock);
ScanKeyEntryInitialize(&scankey, 0, ScanKeyInit(&scankey,
ObjectIdAttributeNumber, ObjectIdAttributeNumber,
BTEqualStrategyNumber, F_OIDEQ, BTEqualStrategyNumber, F_OIDEQ,
ObjectIdGetDatum(castOid), OIDOID); ObjectIdGetDatum(castOid));
scan = systable_beginscan(relation, CastOidIndex, true, scan = systable_beginscan(relation, CastOidIndex, true,
SnapshotNow, 1, &scankey); SnapshotNow, 1, &scankey);
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/commands/indexcmds.c,v 1.114 2003/10/02 06:34:03 petere Exp $ * $Header: /cvsroot/pgsql/src/backend/commands/indexcmds.c,v 1.115 2003/11/12 21:15:50 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -416,6 +416,9 @@ GetIndexOpClass(List *opclass, Oid attrType, ...@@ -416,6 +416,9 @@ GetIndexOpClass(List *opclass, Oid attrType,
* Release 7.2 renames timestamp_ops to timestamptz_ops, so suppress that * Release 7.2 renames timestamp_ops to timestamptz_ops, so suppress that
* too for awhile. I'm starting to think we need a better approach. * too for awhile. I'm starting to think we need a better approach.
* tgl 2000/10/01 * tgl 2000/10/01
*
* Release 7.5 removes bigbox_ops (which was dead code for a long while
* anyway). tgl 2003/11/11
*/ */
if (length(opclass) == 1) if (length(opclass) == 1)
{ {
...@@ -425,7 +428,8 @@ GetIndexOpClass(List *opclass, Oid attrType, ...@@ -425,7 +428,8 @@ GetIndexOpClass(List *opclass, Oid attrType,
strcmp(claname, "timespan_ops") == 0 || strcmp(claname, "timespan_ops") == 0 ||
strcmp(claname, "datetime_ops") == 0 || strcmp(claname, "datetime_ops") == 0 ||
strcmp(claname, "lztext_ops") == 0 || strcmp(claname, "lztext_ops") == 0 ||
strcmp(claname, "timestamp_ops") == 0) strcmp(claname, "timestamp_ops") == 0 ||
strcmp(claname, "bigbox_ops") == 0)
opclass = NIL; opclass = NIL;
} }
......
This diff is collapsed.
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/commands/tablecmds.c,v 1.92 2003/11/09 21:30:36 tgl Exp $ * $Header: /cvsroot/pgsql/src/backend/commands/tablecmds.c,v 1.93 2003/11/12 21:15:51 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -1393,20 +1393,20 @@ update_ri_trigger_args(Oid relid, ...@@ -1393,20 +1393,20 @@ update_ri_trigger_args(Oid relid,
tgrel = heap_openr(TriggerRelationName, RowExclusiveLock); tgrel = heap_openr(TriggerRelationName, RowExclusiveLock);
if (fk_scan) if (fk_scan)
{ {
ScanKeyEntryInitialize(&skey[0], 0, ScanKeyInit(&skey[0],
Anum_pg_trigger_tgconstrrelid, Anum_pg_trigger_tgconstrrelid,
BTEqualStrategyNumber, F_OIDEQ, BTEqualStrategyNumber, F_OIDEQ,
ObjectIdGetDatum(relid), OIDOID); ObjectIdGetDatum(relid));
trigscan = systable_beginscan(tgrel, TriggerConstrRelidIndex, trigscan = systable_beginscan(tgrel, TriggerConstrRelidIndex,
true, SnapshotNow, true, SnapshotNow,
1, skey); 1, skey);
} }
else else
{ {
ScanKeyEntryInitialize(&skey[0], 0, ScanKeyInit(&skey[0],
Anum_pg_trigger_tgrelid, Anum_pg_trigger_tgrelid,
BTEqualStrategyNumber, F_OIDEQ, BTEqualStrategyNumber, F_OIDEQ,
ObjectIdGetDatum(relid), OIDOID); ObjectIdGetDatum(relid));
trigscan = systable_beginscan(tgrel, TriggerRelidNameIndex, trigscan = systable_beginscan(tgrel, TriggerRelidNameIndex,
true, SnapshotNow, true, SnapshotNow,
1, skey); 1, skey);
......
...@@ -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.161 2003/11/09 21:30:36 tgl Exp $ * $Header: /cvsroot/pgsql/src/backend/commands/trigger.c,v 1.162 2003/11/12 21:15:51 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -253,10 +253,10 @@ CreateTrigger(CreateTrigStmt *stmt, bool forConstraint) ...@@ -253,10 +253,10 @@ CreateTrigger(CreateTrigStmt *stmt, bool forConstraint)
* relation, so the trigger set won't be changing underneath us. * relation, so the trigger set won't be changing underneath us.
*/ */
tgrel = heap_openr(TriggerRelationName, RowExclusiveLock); tgrel = heap_openr(TriggerRelationName, RowExclusiveLock);
ScanKeyEntryInitialize(&key, 0, ScanKeyInit(&key,
Anum_pg_trigger_tgrelid, Anum_pg_trigger_tgrelid,
BTEqualStrategyNumber, F_OIDEQ, BTEqualStrategyNumber, F_OIDEQ,
ObjectIdGetDatum(RelationGetRelid(rel)), OIDOID); ObjectIdGetDatum(RelationGetRelid(rel)));
tgscan = systable_beginscan(tgrel, TriggerRelidNameIndex, true, tgscan = systable_beginscan(tgrel, TriggerRelidNameIndex, true,
SnapshotNow, 1, &key); SnapshotNow, 1, &key);
while (HeapTupleIsValid(tuple = systable_getnext(tgscan))) while (HeapTupleIsValid(tuple = systable_getnext(tgscan)))
...@@ -465,15 +465,15 @@ DropTrigger(Oid relid, const char *trigname, DropBehavior behavior) ...@@ -465,15 +465,15 @@ DropTrigger(Oid relid, const char *trigname, DropBehavior behavior)
*/ */
tgrel = heap_openr(TriggerRelationName, AccessShareLock); tgrel = heap_openr(TriggerRelationName, AccessShareLock);
ScanKeyEntryInitialize(&skey[0], 0, ScanKeyInit(&skey[0],
Anum_pg_trigger_tgrelid, Anum_pg_trigger_tgrelid,
BTEqualStrategyNumber, F_OIDEQ, BTEqualStrategyNumber, F_OIDEQ,
ObjectIdGetDatum(relid), OIDOID); ObjectIdGetDatum(relid));
ScanKeyEntryInitialize(&skey[1], 0, ScanKeyInit(&skey[1],
Anum_pg_trigger_tgname, Anum_pg_trigger_tgname,
BTEqualStrategyNumber, F_NAMEEQ, BTEqualStrategyNumber, F_NAMEEQ,
CStringGetDatum(trigname), NAMEOID); CStringGetDatum(trigname));
tgscan = systable_beginscan(tgrel, TriggerRelidNameIndex, true, tgscan = systable_beginscan(tgrel, TriggerRelidNameIndex, true,
SnapshotNow, 2, skey); SnapshotNow, 2, skey);
...@@ -524,10 +524,10 @@ RemoveTriggerById(Oid trigOid) ...@@ -524,10 +524,10 @@ RemoveTriggerById(Oid trigOid)
/* /*
* Find the trigger to delete. * Find the trigger to delete.
*/ */
ScanKeyEntryInitialize(&skey[0], 0, ScanKeyInit(&skey[0],
ObjectIdAttributeNumber, ObjectIdAttributeNumber,
BTEqualStrategyNumber, F_OIDEQ, BTEqualStrategyNumber, F_OIDEQ,
ObjectIdGetDatum(trigOid), OIDOID); ObjectIdGetDatum(trigOid));
tgscan = systable_beginscan(tgrel, TriggerOidIndex, true, tgscan = systable_beginscan(tgrel, TriggerOidIndex, true,
SnapshotNow, 1, skey); SnapshotNow, 1, skey);
...@@ -641,14 +641,14 @@ renametrig(Oid relid, ...@@ -641,14 +641,14 @@ renametrig(Oid relid,
/* /*
* First pass -- look for name conflict * First pass -- look for name conflict
*/ */
ScanKeyEntryInitialize(&key[0], 0, ScanKeyInit(&key[0],
Anum_pg_trigger_tgrelid, Anum_pg_trigger_tgrelid,
BTEqualStrategyNumber, F_OIDEQ, BTEqualStrategyNumber, F_OIDEQ,
ObjectIdGetDatum(relid), OIDOID); ObjectIdGetDatum(relid));
ScanKeyEntryInitialize(&key[1], 0, ScanKeyInit(&key[1],
Anum_pg_trigger_tgname, Anum_pg_trigger_tgname,
BTEqualStrategyNumber, F_NAMEEQ, BTEqualStrategyNumber, F_NAMEEQ,
PointerGetDatum(newname), NAMEOID); PointerGetDatum(newname));
tgscan = systable_beginscan(tgrel, TriggerRelidNameIndex, true, tgscan = systable_beginscan(tgrel, TriggerRelidNameIndex, true,
SnapshotNow, 2, key); SnapshotNow, 2, key);
if (HeapTupleIsValid(tuple = systable_getnext(tgscan))) if (HeapTupleIsValid(tuple = systable_getnext(tgscan)))
...@@ -661,14 +661,14 @@ renametrig(Oid relid, ...@@ -661,14 +661,14 @@ renametrig(Oid relid,
/* /*
* Second pass -- look for trigger existing with oldname and update * Second pass -- look for trigger existing with oldname and update
*/ */
ScanKeyEntryInitialize(&key[0], 0, ScanKeyInit(&key[0],
Anum_pg_trigger_tgrelid, Anum_pg_trigger_tgrelid,
BTEqualStrategyNumber, F_OIDEQ, BTEqualStrategyNumber, F_OIDEQ,
ObjectIdGetDatum(relid), OIDOID); ObjectIdGetDatum(relid));
ScanKeyEntryInitialize(&key[1], 0, ScanKeyInit(&key[1],
Anum_pg_trigger_tgname, Anum_pg_trigger_tgname,
BTEqualStrategyNumber, F_NAMEEQ, BTEqualStrategyNumber, F_NAMEEQ,
PointerGetDatum(oldname), NAMEOID); PointerGetDatum(oldname));
tgscan = systable_beginscan(tgrel, TriggerRelidNameIndex, true, tgscan = systable_beginscan(tgrel, TriggerRelidNameIndex, true,
SnapshotNow, 2, key); SnapshotNow, 2, key);
if (HeapTupleIsValid(tuple = systable_getnext(tgscan))) if (HeapTupleIsValid(tuple = systable_getnext(tgscan)))
...@@ -744,11 +744,10 @@ RelationBuildTriggers(Relation relation) ...@@ -744,11 +744,10 @@ RelationBuildTriggers(Relation relation)
* emergency-recovery operations (ie, IsIgnoringSystemIndexes). This * emergency-recovery operations (ie, IsIgnoringSystemIndexes). This
* in turn ensures that triggers will be fired in name order. * in turn ensures that triggers will be fired in name order.
*/ */
ScanKeyEntryInitialize(&skey, 0, ScanKeyInit(&skey,
Anum_pg_trigger_tgrelid, Anum_pg_trigger_tgrelid,
BTEqualStrategyNumber, F_OIDEQ, BTEqualStrategyNumber, F_OIDEQ,
ObjectIdGetDatum(RelationGetRelid(relation)), ObjectIdGetDatum(RelationGetRelid(relation)));
OIDOID);
tgrel = heap_openr(TriggerRelationName, AccessShareLock); tgrel = heap_openr(TriggerRelationName, AccessShareLock);
tgscan = systable_beginscan(tgrel, TriggerRelidNameIndex, true, tgscan = systable_beginscan(tgrel, TriggerRelidNameIndex, true,
...@@ -2262,10 +2261,10 @@ DeferredTriggerSetState(ConstraintsSetStmt *stmt) ...@@ -2262,10 +2261,10 @@ DeferredTriggerSetState(ConstraintsSetStmt *stmt)
/* /*
* Setup to scan pg_trigger by tgconstrname ... * Setup to scan pg_trigger by tgconstrname ...
*/ */
ScanKeyEntryInitialize(&skey, 0, ScanKeyInit(&skey,
Anum_pg_trigger_tgconstrname, Anum_pg_trigger_tgconstrname,
BTEqualStrategyNumber, F_NAMEEQ, BTEqualStrategyNumber, F_NAMEEQ,
PointerGetDatum(cname), NAMEOID); PointerGetDatum(cname));
tgscan = systable_beginscan(tgrel, TriggerConstrNameIndex, true, tgscan = systable_beginscan(tgrel, TriggerConstrNameIndex, true,
SnapshotNow, 1, &skey); SnapshotNow, 1, &skey);
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/commands/typecmds.c,v 1.49 2003/11/09 21:30:36 tgl Exp $ * $Header: /cvsroot/pgsql/src/backend/commands/typecmds.c,v 1.50 2003/11/12 21:15:51 tgl Exp $
* *
* DESCRIPTION * DESCRIPTION
* The "DefineFoo" routines take the parse tree and pick out the * The "DefineFoo" routines take the parse tree and pick out the
...@@ -1362,10 +1362,10 @@ AlterDomainDropConstraint(List *names, const char *constrName, DropBehavior beha ...@@ -1362,10 +1362,10 @@ AlterDomainDropConstraint(List *names, const char *constrName, DropBehavior beha
conrel = heap_openr(ConstraintRelationName, RowExclusiveLock); conrel = heap_openr(ConstraintRelationName, RowExclusiveLock);
/* Use the index to scan only constraints of the target relation */ /* Use the index to scan only constraints of the target relation */
ScanKeyEntryInitialize(&key[0], 0, ScanKeyInit(&key[0],
Anum_pg_constraint_contypid, Anum_pg_constraint_contypid,
BTEqualStrategyNumber, F_OIDEQ, BTEqualStrategyNumber, F_OIDEQ,
ObjectIdGetDatum(HeapTupleGetOid(tup)), OIDOID); ObjectIdGetDatum(HeapTupleGetOid(tup)));
conscan = systable_beginscan(conrel, ConstraintTypidIndex, true, conscan = systable_beginscan(conrel, ConstraintTypidIndex, true,
SnapshotNow, 1, key); SnapshotNow, 1, key);
...@@ -1615,14 +1615,14 @@ get_rels_with_domain(Oid domainOid, LOCKMODE lockmode) ...@@ -1615,14 +1615,14 @@ get_rels_with_domain(Oid domainOid, LOCKMODE lockmode)
*/ */
depRel = relation_openr(DependRelationName, AccessShareLock); depRel = relation_openr(DependRelationName, AccessShareLock);
ScanKeyEntryInitialize(&key[0], 0, ScanKeyInit(&key[0],
Anum_pg_depend_refclassid, Anum_pg_depend_refclassid,
BTEqualStrategyNumber, F_OIDEQ, BTEqualStrategyNumber, F_OIDEQ,
ObjectIdGetDatum(RelOid_pg_type), OIDOID); ObjectIdGetDatum(RelOid_pg_type));
ScanKeyEntryInitialize(&key[1], 0, ScanKeyInit(&key[1],
Anum_pg_depend_refobjid, Anum_pg_depend_refobjid,
BTEqualStrategyNumber, F_OIDEQ, BTEqualStrategyNumber, F_OIDEQ,
ObjectIdGetDatum(domainOid), OIDOID); ObjectIdGetDatum(domainOid));
depScan = systable_beginscan(depRel, DependReferenceIndex, true, depScan = systable_beginscan(depRel, DependReferenceIndex, true,
SnapshotNow, 2, key); SnapshotNow, 2, key);
...@@ -1901,10 +1901,10 @@ GetDomainConstraints(Oid typeOid) ...@@ -1901,10 +1901,10 @@ GetDomainConstraints(Oid typeOid)
notNull = true; notNull = true;
/* Look for CHECK Constraints on this domain */ /* Look for CHECK Constraints on this domain */
ScanKeyEntryInitialize(&key[0], 0, ScanKeyInit(&key[0],
Anum_pg_constraint_contypid, Anum_pg_constraint_contypid,
BTEqualStrategyNumber, F_OIDEQ, BTEqualStrategyNumber, F_OIDEQ,
ObjectIdGetDatum(typeOid), OIDOID); ObjectIdGetDatum(typeOid));
scan = systable_beginscan(conRel, ConstraintTypidIndex, true, scan = systable_beginscan(conRel, ConstraintTypidIndex, true,
SnapshotNow, 1, key); SnapshotNow, 1, key);
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group * Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California * Portions Copyright (c) 1994, Regents of the University of California
* *
* $Header: /cvsroot/pgsql/src/backend/commands/user.c,v 1.129 2003/11/09 21:30:36 tgl Exp $ * $Header: /cvsroot/pgsql/src/backend/commands/user.c,v 1.130 2003/11/12 21:15:51 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -1074,10 +1074,10 @@ DropUser(DropUserStmt *stmt) ...@@ -1074,10 +1074,10 @@ DropUser(DropUserStmt *stmt)
pg_rel = heap_openr(DatabaseRelationName, AccessShareLock); pg_rel = heap_openr(DatabaseRelationName, AccessShareLock);
pg_dsc = RelationGetDescr(pg_rel); pg_dsc = RelationGetDescr(pg_rel);
ScanKeyEntryInitialize(&scankey, 0, ScanKeyInit(&scankey,
Anum_pg_database_datdba, Anum_pg_database_datdba,
BTEqualStrategyNumber, F_INT4EQ, BTEqualStrategyNumber, F_INT4EQ,
Int32GetDatum(usesysid), INT4OID); Int32GetDatum(usesysid));
scan = heap_beginscan(pg_rel, SnapshotNow, 1, &scankey); scan = heap_beginscan(pg_rel, SnapshotNow, 1, &scankey);
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/commands/vacuum.c,v 1.264 2003/11/09 21:30:36 tgl Exp $ * $Header: /cvsroot/pgsql/src/backend/commands/vacuum.c,v 1.265 2003/11/12 21:15:51 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -30,7 +30,6 @@ ...@@ -30,7 +30,6 @@
#include "catalog/namespace.h" #include "catalog/namespace.h"
#include "catalog/pg_database.h" #include "catalog/pg_database.h"
#include "catalog/pg_index.h" #include "catalog/pg_index.h"
#include "catalog/pg_type.h"
#include "commands/vacuum.h" #include "commands/vacuum.h"
#include "executor/executor.h" #include "executor/executor.h"
#include "miscadmin.h" #include "miscadmin.h"
...@@ -400,10 +399,10 @@ getrels(const RangeVar *vacrel, const char *stmttype) ...@@ -400,10 +399,10 @@ getrels(const RangeVar *vacrel, const char *stmttype)
HeapTuple tuple; HeapTuple tuple;
ScanKeyData key; ScanKeyData key;
ScanKeyEntryInitialize(&key, 0, ScanKeyInit(&key,
Anum_pg_class_relkind, Anum_pg_class_relkind,
BTEqualStrategyNumber, F_CHAREQ, BTEqualStrategyNumber, F_CHAREQ,
CharGetDatum(RELKIND_RELATION), CHAROID); CharGetDatum(RELKIND_RELATION));
pgclass = heap_openr(RelationRelationName, AccessShareLock); pgclass = heap_openr(RelationRelationName, AccessShareLock);
...@@ -583,10 +582,10 @@ vac_update_dbstats(Oid dbid, ...@@ -583,10 +582,10 @@ vac_update_dbstats(Oid dbid,
relation = heap_openr(DatabaseRelationName, RowExclusiveLock); relation = heap_openr(DatabaseRelationName, RowExclusiveLock);
/* Must use a heap scan, since there's no syscache for pg_database */ /* Must use a heap scan, since there's no syscache for pg_database */
ScanKeyEntryInitialize(&entry[0], 0, ScanKeyInit(&entry[0],
ObjectIdAttributeNumber, ObjectIdAttributeNumber,
BTEqualStrategyNumber, F_OIDEQ, BTEqualStrategyNumber, F_OIDEQ,
ObjectIdGetDatum(dbid), OIDOID); ObjectIdGetDatum(dbid));
scan = heap_beginscan(relation, SnapshotNow, 1, entry); scan = heap_beginscan(relation, SnapshotNow, 1, entry);
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/executor/nodeIndexscan.c,v 1.85 2003/11/09 21:30:36 tgl Exp $ * $Header: /cvsroot/pgsql/src/backend/executor/nodeIndexscan.c,v 1.86 2003/11/12 21:15:52 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -31,7 +31,6 @@ ...@@ -31,7 +31,6 @@
#include "miscadmin.h" #include "miscadmin.h"
#include "nodes/nodeFuncs.h" #include "nodes/nodeFuncs.h"
#include "optimizer/clauses.h" #include "optimizer/clauses.h"
#include "parser/parse_expr.h"
#include "parser/parsetree.h" #include "parser/parsetree.h"
...@@ -615,6 +614,7 @@ ExecInitIndexScan(IndexScan *node, EState *estate) ...@@ -615,6 +614,7 @@ ExecInitIndexScan(IndexScan *node, EState *estate)
IndexScanState *indexstate; IndexScanState *indexstate;
List *indxqual; List *indxqual;
List *indxstrategy; List *indxstrategy;
List *indxsubtype;
List *indxid; List *indxid;
int i; int i;
int numIndices; int numIndices;
...@@ -711,10 +711,12 @@ ExecInitIndexScan(IndexScan *node, EState *estate) ...@@ -711,10 +711,12 @@ ExecInitIndexScan(IndexScan *node, EState *estate)
*/ */
indxqual = node->indxqual; indxqual = node->indxqual;
indxstrategy = node->indxstrategy; indxstrategy = node->indxstrategy;
indxsubtype = node->indxsubtype;
for (i = 0; i < numIndices; i++) for (i = 0; i < numIndices; i++)
{ {
List *quals; List *quals;
List *strategies; List *strategies;
List *subtypes;
int n_keys; int n_keys;
ScanKey scan_keys; ScanKey scan_keys;
ExprState **run_keys; ExprState **run_keys;
...@@ -724,6 +726,8 @@ ExecInitIndexScan(IndexScan *node, EState *estate) ...@@ -724,6 +726,8 @@ ExecInitIndexScan(IndexScan *node, EState *estate)
indxqual = lnext(indxqual); indxqual = lnext(indxqual);
strategies = lfirst(indxstrategy); strategies = lfirst(indxstrategy);
indxstrategy = lnext(indxstrategy); indxstrategy = lnext(indxstrategy);
subtypes = lfirst(indxsubtype);
indxsubtype = lnext(indxsubtype);
n_keys = length(quals); n_keys = length(quals);
scan_keys = (n_keys <= 0) ? (ScanKey) NULL : scan_keys = (n_keys <= 0) ? (ScanKey) NULL :
(ScanKey) palloc(n_keys * sizeof(ScanKeyData)); (ScanKey) palloc(n_keys * sizeof(ScanKeyData));
...@@ -742,9 +746,9 @@ ExecInitIndexScan(IndexScan *node, EState *estate) ...@@ -742,9 +746,9 @@ ExecInitIndexScan(IndexScan *node, EState *estate)
int flags = 0; int flags = 0;
AttrNumber varattno; /* att number used in scan */ AttrNumber varattno; /* att number used in scan */
StrategyNumber strategy; /* op's strategy number */ StrategyNumber strategy; /* op's strategy number */
Oid subtype; /* op's strategy subtype */
RegProcedure opfuncid; /* operator proc id used in scan */ RegProcedure opfuncid; /* operator proc id used in scan */
Datum scanvalue; /* value used in scan (if const) */ Datum scanvalue; /* value used in scan (if const) */
Oid rhstype; /* datatype of comparison value */
/* /*
* extract clause information from the qualification * extract clause information from the qualification
...@@ -753,6 +757,8 @@ ExecInitIndexScan(IndexScan *node, EState *estate) ...@@ -753,6 +757,8 @@ ExecInitIndexScan(IndexScan *node, EState *estate)
quals = lnext(quals); quals = lnext(quals);
strategy = lfirsti(strategies); strategy = lfirsti(strategies);
strategies = lnext(strategies); strategies = lnext(strategies);
subtype = lfirsto(subtypes);
subtypes = lnext(subtypes);
if (!IsA(clause, OpExpr)) if (!IsA(clause, OpExpr))
elog(ERROR, "indxqual is not an OpExpr"); elog(ERROR, "indxqual is not an OpExpr");
...@@ -795,8 +801,6 @@ ExecInitIndexScan(IndexScan *node, EState *estate) ...@@ -795,8 +801,6 @@ ExecInitIndexScan(IndexScan *node, EState *estate)
*/ */
rightop = (Expr *) get_rightop((Expr *) clause); rightop = (Expr *) get_rightop((Expr *) clause);
rhstype = exprType((Node *) rightop);
if (rightop && IsA(rightop, RelabelType)) if (rightop && IsA(rightop, RelabelType))
rightop = ((RelabelType *) rightop)->arg; rightop = ((RelabelType *) rightop)->arg;
...@@ -832,9 +836,9 @@ ExecInitIndexScan(IndexScan *node, EState *estate) ...@@ -832,9 +836,9 @@ ExecInitIndexScan(IndexScan *node, EState *estate)
varattno, /* attribute number to varattno, /* attribute number to
* scan */ * scan */
strategy, /* op's strategy */ strategy, /* op's strategy */
subtype, /* strategy subtype */
opfuncid, /* reg proc to use */ opfuncid, /* reg proc to use */
scanvalue, /* constant */ scanvalue); /* constant */
rhstype); /* constant's type */
} }
/* /*
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,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/nodes/copyfuncs.c,v 1.266 2003/11/09 21:30:36 tgl Exp $ * $Header: /cvsroot/pgsql/src/backend/nodes/copyfuncs.c,v 1.267 2003/11/12 21:15:52 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -273,6 +273,17 @@ _copyIndexScan(IndexScan *from) ...@@ -273,6 +273,17 @@ _copyIndexScan(IndexScan *from)
} }
newnode->indxstrategy = newstrat; newnode->indxstrategy = newstrat;
} }
/* this can become COPY_NODE_FIELD when OID lists are normal objects: */
{
List *newsubtype = NIL;
List *tmp;
foreach(tmp, from->indxsubtype)
{
newsubtype = lappend(newsubtype, listCopy(lfirst(tmp)));
}
newnode->indxsubtype = newsubtype;
}
COPY_SCALAR_FIELD(indxorderdir); COPY_SCALAR_FIELD(indxorderdir);
return newnode; return newnode;
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/nodes/outfuncs.c,v 1.219 2003/11/09 21:30:36 tgl Exp $ * $Header: /cvsroot/pgsql/src/backend/nodes/outfuncs.c,v 1.220 2003/11/12 21:15:52 tgl Exp $
* *
* NOTES * NOTES
* Every node type that can appear in stored rules' parsetrees *must* * Every node type that can appear in stored rules' parsetrees *must*
...@@ -346,6 +346,16 @@ _outIndexScan(StringInfo str, IndexScan *node) ...@@ -346,6 +346,16 @@ _outIndexScan(StringInfo str, IndexScan *node)
_outIntList(str, lfirst(tmp)); _outIntList(str, lfirst(tmp));
} }
} }
/* this can become WRITE_NODE_FIELD when OID lists are normal objects: */
{
List *tmp;
appendStringInfo(str, " :indxsubtype ");
foreach(tmp, node->indxsubtype)
{
_outOidList(str, lfirst(tmp));
}
}
WRITE_ENUM_FIELD(indxorderdir, ScanDirection); WRITE_ENUM_FIELD(indxorderdir, ScanDirection);
} }
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/indxpath.c,v 1.147 2003/08/04 02:40:00 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/optimizer/path/indxpath.c,v 1.148 2003/11/12 21:15:52 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -1072,7 +1072,7 @@ pred_test_recurse_pred(Expr *predicate, Node *clause) ...@@ -1072,7 +1072,7 @@ pred_test_recurse_pred(Expr *predicate, Node *clause)
* *
* If you know, for some ATTR, that "ATTR given_op CONST1" is true, and you * If you know, for some ATTR, that "ATTR given_op CONST1" is true, and you
* want to determine whether "ATTR target_op CONST2" must also be true, then * want to determine whether "ATTR target_op CONST2" must also be true, then
* you can use "CONST1 test_op CONST2" as a test. If this test returns true, * you can use "CONST2 test_op CONST1" as a test. If this test returns true,
* then the target expression must be true; if the test returns false, then * then the target expression must be true; if the test returns false, then
* the target expression may be false. * the target expression may be false.
* *
...@@ -1082,11 +1082,11 @@ pred_test_recurse_pred(Expr *predicate, Node *clause) ...@@ -1082,11 +1082,11 @@ pred_test_recurse_pred(Expr *predicate, Node *clause)
static const StrategyNumber static const StrategyNumber
BT_implic_table[BTMaxStrategyNumber][BTMaxStrategyNumber] = { BT_implic_table[BTMaxStrategyNumber][BTMaxStrategyNumber] = {
{2, 2, 0, 0, 0}, {4, 4, 0, 0, 0},
{1, 2, 0, 0, 0}, {5, 4, 0, 0, 0},
{1, 2, 3, 4, 5}, {5, 4, 3, 2, 1},
{0, 0, 0, 4, 5}, {0, 0, 0, 2, 1},
{0, 0, 0, 4, 4} {0, 0, 0, 2, 2}
}; };
...@@ -1118,12 +1118,13 @@ pred_test_simple_clause(Expr *predicate, Node *clause) ...@@ -1118,12 +1118,13 @@ pred_test_simple_clause(Expr *predicate, Node *clause)
*clause_const; *clause_const;
Oid pred_op, Oid pred_op,
clause_op, clause_op,
test_op; test_op = InvalidOid;
Oid opclass_id = InvalidOid; Oid opclass_id;
bool found = false; bool found = false;
StrategyNumber pred_strategy = 0, StrategyNumber pred_strategy,
clause_strategy = 0, clause_strategy,
test_strategy; test_strategy;
Oid clause_subtype;
Expr *test_expr; Expr *test_expr;
ExprState *test_exprstate; ExprState *test_exprstate;
Datum test_result; Datum test_result;
...@@ -1140,7 +1141,9 @@ pred_test_simple_clause(Expr *predicate, Node *clause) ...@@ -1140,7 +1141,9 @@ pred_test_simple_clause(Expr *predicate, Node *clause)
/* /*
* Can't do anything more unless they are both binary opclauses with a * Can't do anything more unless they are both binary opclauses with a
* Var on the left and a Const on the right. (XXX someday try to * Var on the left and a Const on the right. (XXX someday try to
* commute Const/Var cases?) * commute Const/Var cases?) Note we don't have to think about binary
* relabeling of the Const node, since that would have been folded right
* into the Const.
*/ */
if (!is_opclause(predicate)) if (!is_opclause(predicate))
return false; return false;
...@@ -1173,14 +1176,20 @@ pred_test_simple_clause(Expr *predicate, Node *clause) ...@@ -1173,14 +1176,20 @@ pred_test_simple_clause(Expr *predicate, Node *clause)
clause_op = ((OpExpr *) clause)->opno; clause_op = ((OpExpr *) clause)->opno;
/* /*
* 1. Find "btree" strategy numbers for the pred_op and clause_op. * Try to find a btree opclass containing the needed operators.
* *
* We must find a btree opclass that contains both operators, else the * We must find a btree opclass that contains both operators, else the
* implication can't be determined. If there are multiple such * implication can't be determined. Also, the pred_op has to be of
* opclasses, assume we can use any one to determine the logical * default subtype (implying left and right input datatypes are the same);
* relationship of the two operators and the correct corresponding * otherwise it's unsafe to put the pred_const on the left side of the
* test operator. This should work for any logically consistent * test. Also, the opclass must contain a suitable test operator
* opclasses. * matching the clause_const's type (which we take to mean that it has
* the same subtype as the original clause_operator).
*
* If there are multiple matching opclasses, assume we can use any one to
* determine the logical relationship of the two operators and the correct
* corresponding test operator. This should work for any logically
* consistent opclasses.
*/ */
catlist = SearchSysCacheList(AMOPOPID, 1, catlist = SearchSysCacheList(AMOPOPID, 1,
ObjectIdGetDatum(pred_op), ObjectIdGetDatum(pred_op),
...@@ -1192,7 +1201,13 @@ pred_test_simple_clause(Expr *predicate, Node *clause) ...@@ -1192,7 +1201,13 @@ pred_test_simple_clause(Expr *predicate, Node *clause)
Form_pg_amop pred_form = (Form_pg_amop) GETSTRUCT(pred_tuple); Form_pg_amop pred_form = (Form_pg_amop) GETSTRUCT(pred_tuple);
HeapTuple clause_tuple; HeapTuple clause_tuple;
if (!opclass_is_btree(pred_form->amopclaid)) opclass_id = pred_form->amopclaid;
/* must be btree */
if (!opclass_is_btree(opclass_id))
continue;
/* predicate operator must be default within this opclass */
if (pred_form->amopsubtype != InvalidOid)
continue; continue;
/* Get the predicate operator's btree strategy number */ /* Get the predicate operator's btree strategy number */
...@@ -1200,12 +1215,7 @@ pred_test_simple_clause(Expr *predicate, Node *clause) ...@@ -1200,12 +1215,7 @@ pred_test_simple_clause(Expr *predicate, Node *clause)
Assert(pred_strategy >= 1 && pred_strategy <= 5); Assert(pred_strategy >= 1 && pred_strategy <= 5);
/* /*
* Remember which operator class this strategy number came from * From the same opclass, find a strategy number for the clause_op,
*/
opclass_id = pred_form->amopclaid;
/*
* From the same opclass, find a strategy num for the clause_op,
* if possible * if possible
*/ */
clause_tuple = SearchSysCache(AMOPOPID, clause_tuple = SearchSysCache(AMOPOPID,
...@@ -1216,13 +1226,35 @@ pred_test_simple_clause(Expr *predicate, Node *clause) ...@@ -1216,13 +1226,35 @@ pred_test_simple_clause(Expr *predicate, Node *clause)
{ {
Form_pg_amop clause_form = (Form_pg_amop) GETSTRUCT(clause_tuple); Form_pg_amop clause_form = (Form_pg_amop) GETSTRUCT(clause_tuple);
/* Get the restriction clause operator's strategy number */ /* Get the restriction clause operator's strategy/subtype */
clause_strategy = (StrategyNumber) clause_form->amopstrategy; clause_strategy = (StrategyNumber) clause_form->amopstrategy;
Assert(clause_strategy >= 1 && clause_strategy <= 5); Assert(clause_strategy >= 1 && clause_strategy <= 5);
clause_subtype = clause_form->amopsubtype;
/* done with clause_tuple */
ReleaseSysCache(clause_tuple); ReleaseSysCache(clause_tuple);
found = true;
break; /*
* Look up the "test" strategy number in the implication table
*/
test_strategy = BT_implic_table[clause_strategy - 1][pred_strategy - 1];
if (test_strategy == 0)
{
/* Can't determine implication using this interpretation */
continue;
}
/*
* See if opclass has an operator for the test strategy and the
* clause datatype.
*/
test_op = get_opclass_member(opclass_id, clause_subtype,
test_strategy);
if (OidIsValid(test_op))
{
found = true;
break;
}
} }
} }
...@@ -1235,25 +1267,7 @@ pred_test_simple_clause(Expr *predicate, Node *clause) ...@@ -1235,25 +1267,7 @@ pred_test_simple_clause(Expr *predicate, Node *clause)
} }
/* /*
* 2. Look up the "test" strategy number in the implication table * Evaluate the test. For this we need an EState.
*/
test_strategy = BT_implic_table[clause_strategy - 1][pred_strategy - 1];
if (test_strategy == 0)
return false; /* the implication cannot be determined */
/*
* 3. From the same opclass, find the operator for the test strategy
*/
test_op = get_opclass_member(opclass_id, test_strategy);
if (!OidIsValid(test_op))
{
/* This should not fail, else pg_amop entry is missing */
elog(ERROR, "missing pg_amop entry for opclass %u strategy %d",
opclass_id, test_strategy);
}
/*
* 4. Evaluate the test. For this we need an EState.
*/ */
estate = CreateExecutorState(); estate = CreateExecutorState();
...@@ -1264,8 +1278,8 @@ pred_test_simple_clause(Expr *predicate, Node *clause) ...@@ -1264,8 +1278,8 @@ pred_test_simple_clause(Expr *predicate, Node *clause)
test_expr = make_opclause(test_op, test_expr = make_opclause(test_op,
BOOLOID, BOOLOID,
false, false,
(Expr *) clause_const, (Expr *) pred_const,
(Expr *) pred_const); (Expr *) clause_const);
/* Prepare it for execution */ /* Prepare it for execution */
test_exprstate = ExecPrepareExpr(test_expr, estate); test_exprstate = ExecPrepareExpr(test_expr, estate);
...@@ -1907,7 +1921,7 @@ match_special_index_operator(Expr *clause, Oid opclass, ...@@ -1907,7 +1921,7 @@ match_special_index_operator(Expr *clause, Oid opclass,
* (The latter is not depended on by any part of the planner, so far as I can * (The latter is not depended on by any part of the planner, so far as I can
* tell; but some parts of the executor do assume that the indxqual list * tell; but some parts of the executor do assume that the indxqual list
* ultimately delivered to the executor is so ordered. One such place is * ultimately delivered to the executor is so ordered. One such place is
* _bt_orderkeys() in the btree support. Perhaps that ought to be fixed * _bt_preprocess_keys() in the btree support. Perhaps that ought to be fixed
* someday --- tgl 7/00) * someday --- tgl 7/00)
*/ */
List * List *
...@@ -2103,7 +2117,8 @@ prefix_quals(Node *leftop, Oid opclass, ...@@ -2103,7 +2117,8 @@ prefix_quals(Node *leftop, Oid opclass,
*/ */
if (pstatus == Pattern_Prefix_Exact) if (pstatus == Pattern_Prefix_Exact)
{ {
oproid = get_opclass_member(opclass, BTEqualStrategyNumber); oproid = get_opclass_member(opclass, InvalidOid,
BTEqualStrategyNumber);
if (oproid == InvalidOid) if (oproid == InvalidOid)
elog(ERROR, "no = operator for opclass %u", opclass); elog(ERROR, "no = operator for opclass %u", opclass);
expr = make_opclause(oproid, BOOLOID, false, expr = make_opclause(oproid, BOOLOID, false,
...@@ -2117,7 +2132,8 @@ prefix_quals(Node *leftop, Oid opclass, ...@@ -2117,7 +2132,8 @@ prefix_quals(Node *leftop, Oid opclass,
* *
* We can always say "x >= prefix". * We can always say "x >= prefix".
*/ */
oproid = get_opclass_member(opclass, BTGreaterEqualStrategyNumber); oproid = get_opclass_member(opclass, InvalidOid,
BTGreaterEqualStrategyNumber);
if (oproid == InvalidOid) if (oproid == InvalidOid)
elog(ERROR, "no >= operator for opclass %u", opclass); elog(ERROR, "no >= operator for opclass %u", opclass);
expr = make_opclause(oproid, BOOLOID, false, expr = make_opclause(oproid, BOOLOID, false,
...@@ -2132,7 +2148,8 @@ prefix_quals(Node *leftop, Oid opclass, ...@@ -2132,7 +2148,8 @@ prefix_quals(Node *leftop, Oid opclass,
greaterstr = make_greater_string(prefix_const); greaterstr = make_greater_string(prefix_const);
if (greaterstr) if (greaterstr)
{ {
oproid = get_opclass_member(opclass, BTLessStrategyNumber); oproid = get_opclass_member(opclass, InvalidOid,
BTLessStrategyNumber);
if (oproid == InvalidOid) if (oproid == InvalidOid)
elog(ERROR, "no < operator for opclass %u", opclass); elog(ERROR, "no < operator for opclass %u", opclass);
expr = make_opclause(oproid, BOOLOID, false, expr = make_opclause(oproid, BOOLOID, false,
...@@ -2189,13 +2206,15 @@ network_prefix_quals(Node *leftop, Oid expr_op, Oid opclass, Datum rightop) ...@@ -2189,13 +2206,15 @@ network_prefix_quals(Node *leftop, Oid expr_op, Oid opclass, Datum rightop)
*/ */
if (is_eq) if (is_eq)
{ {
opr1oid = get_opclass_member(opclass, BTGreaterEqualStrategyNumber); opr1oid = get_opclass_member(opclass, InvalidOid,
BTGreaterEqualStrategyNumber);
if (opr1oid == InvalidOid) if (opr1oid == InvalidOid)
elog(ERROR, "no >= operator for opclass %u", opclass); elog(ERROR, "no >= operator for opclass %u", opclass);
} }
else else
{ {
opr1oid = get_opclass_member(opclass, BTGreaterStrategyNumber); opr1oid = get_opclass_member(opclass, InvalidOid,
BTGreaterStrategyNumber);
if (opr1oid == InvalidOid) if (opr1oid == InvalidOid)
elog(ERROR, "no > operator for opclass %u", opclass); elog(ERROR, "no > operator for opclass %u", opclass);
} }
...@@ -2210,7 +2229,8 @@ network_prefix_quals(Node *leftop, Oid expr_op, Oid opclass, Datum rightop) ...@@ -2210,7 +2229,8 @@ network_prefix_quals(Node *leftop, Oid expr_op, Oid opclass, Datum rightop)
/* create clause "key <= network_scan_last( rightop )" */ /* create clause "key <= network_scan_last( rightop )" */
opr2oid = get_opclass_member(opclass, BTLessEqualStrategyNumber); opr2oid = get_opclass_member(opclass, InvalidOid,
BTLessEqualStrategyNumber);
if (opr2oid == InvalidOid) if (opr2oid == InvalidOid)
elog(ERROR, "no <= operator for opclass %u", opclass); elog(ERROR, "no <= operator for opclass %u", opclass);
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/optimizer/plan/createplan.c,v 1.158 2003/11/09 21:30:36 tgl Exp $ * $Header: /cvsroot/pgsql/src/backend/optimizer/plan/createplan.c,v 1.159 2003/11/12 21:15:53 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -63,13 +63,15 @@ static HashJoin *create_hashjoin_plan(Query *root, HashPath *best_path, ...@@ -63,13 +63,15 @@ static HashJoin *create_hashjoin_plan(Query *root, HashPath *best_path,
static void fix_indxqual_references(List *indexquals, IndexPath *index_path, static void fix_indxqual_references(List *indexquals, IndexPath *index_path,
List **fixed_indexquals, List **fixed_indexquals,
List **recheck_indexquals, List **recheck_indexquals,
List **indxstrategy); List **indxstrategy,
List **indxsubtype);
static void fix_indxqual_sublist(List *indexqual, static void fix_indxqual_sublist(List *indexqual,
Relids baserelids, int baserelid, Relids baserelids, int baserelid,
IndexOptInfo *index, IndexOptInfo *index,
List **fixed_quals, List **fixed_quals,
List **recheck_quals, List **recheck_quals,
List **strategy); List **strategy,
List **subtype);
static Node *fix_indxqual_operand(Node *node, int baserelid, static Node *fix_indxqual_operand(Node *node, int baserelid,
IndexOptInfo *index, IndexOptInfo *index,
Oid *opclass); Oid *opclass);
...@@ -79,8 +81,8 @@ static void copy_path_costsize(Plan *dest, Path *src); ...@@ -79,8 +81,8 @@ static void copy_path_costsize(Plan *dest, Path *src);
static void copy_plan_costsize(Plan *dest, Plan *src); static void copy_plan_costsize(Plan *dest, Plan *src);
static SeqScan *make_seqscan(List *qptlist, List *qpqual, Index scanrelid); static SeqScan *make_seqscan(List *qptlist, List *qpqual, Index scanrelid);
static IndexScan *make_indexscan(List *qptlist, List *qpqual, Index scanrelid, static IndexScan *make_indexscan(List *qptlist, List *qpqual, Index scanrelid,
List *indxid, List *indxqual, List *indxid, List *indxqual, List *indxqualorig,
List *indxqualorig, List *indxstrategy, List *indxstrategy, List *indxsubtype,
ScanDirection indexscandir); ScanDirection indexscandir);
static TidScan *make_tidscan(List *qptlist, List *qpqual, Index scanrelid, static TidScan *make_tidscan(List *qptlist, List *qpqual, Index scanrelid,
List *tideval); List *tideval);
...@@ -704,6 +706,7 @@ create_indexscan_plan(Query *root, ...@@ -704,6 +706,7 @@ create_indexscan_plan(Query *root,
List *fixed_indxqual; List *fixed_indxqual;
List *recheck_indxqual; List *recheck_indxqual;
List *indxstrategy; List *indxstrategy;
List *indxsubtype;
FastList indexids; FastList indexids;
List *ixinfo; List *ixinfo;
IndexScan *scan_plan; IndexScan *scan_plan;
...@@ -771,7 +774,7 @@ create_indexscan_plan(Query *root, ...@@ -771,7 +774,7 @@ create_indexscan_plan(Query *root,
*/ */
fix_indxqual_references(indxqual, best_path, fix_indxqual_references(indxqual, best_path,
&fixed_indxqual, &recheck_indxqual, &fixed_indxqual, &recheck_indxqual,
&indxstrategy); &indxstrategy, &indxsubtype);
/* /*
* If there were any "lossy" operators, need to add back the * If there were any "lossy" operators, need to add back the
...@@ -804,6 +807,7 @@ create_indexscan_plan(Query *root, ...@@ -804,6 +807,7 @@ create_indexscan_plan(Query *root,
fixed_indxqual, fixed_indxqual,
indxqual, indxqual,
indxstrategy, indxstrategy,
indxsubtype,
best_path->indexscandir); best_path->indexscandir);
copy_path_costsize(&scan_plan->scan.plan, &best_path->path); copy_path_costsize(&scan_plan->scan.plan, &best_path->path);
...@@ -1151,8 +1155,8 @@ create_hashjoin_plan(Query *root, ...@@ -1151,8 +1155,8 @@ create_hashjoin_plan(Query *root,
* must add (the original form of) the indexqual clause to the "qpquals" * must add (the original form of) the indexqual clause to the "qpquals"
* of the indexscan node, where the operator will be re-evaluated to * of the indexscan node, where the operator will be re-evaluated to
* ensure it passes. * ensure it passes.
* * We must construct a list of operator strategy numbers corresponding * * We must construct lists of operator strategy numbers and subtypes for
* to the top-level operators of each index clause. * the top-level operators of each index clause.
* *
* Both the input list and the output lists have the form of lists of sublists * Both the input list and the output lists have the form of lists of sublists
* of qual clauses --- the top-level list has one entry for each indexscan * of qual clauses --- the top-level list has one entry for each indexscan
...@@ -1167,11 +1171,12 @@ create_hashjoin_plan(Query *root, ...@@ -1167,11 +1171,12 @@ create_hashjoin_plan(Query *root,
* need rechecking. * need rechecking.
* *
* indxstrategy receives a list of integer sublists of strategy numbers. * indxstrategy receives a list of integer sublists of strategy numbers.
* indxsubtype receives a list of OID sublists of strategy subtypes.
*/ */
static void static void
fix_indxqual_references(List *indexquals, IndexPath *index_path, fix_indxqual_references(List *indexquals, IndexPath *index_path,
List **fixed_indexquals, List **recheck_indexquals, List **fixed_indexquals, List **recheck_indexquals,
List **indxstrategy) List **indxstrategy, List **indxsubtype)
{ {
FastList fixed_quals; FastList fixed_quals;
FastList recheck_quals; FastList recheck_quals;
...@@ -1183,6 +1188,7 @@ fix_indxqual_references(List *indexquals, IndexPath *index_path, ...@@ -1183,6 +1188,7 @@ fix_indxqual_references(List *indexquals, IndexPath *index_path,
FastListInit(&fixed_quals); FastListInit(&fixed_quals);
FastListInit(&recheck_quals); FastListInit(&recheck_quals);
*indxstrategy = NIL; *indxstrategy = NIL;
*indxsubtype = NIL;
foreach(i, indexquals) foreach(i, indexquals)
{ {
List *indexqual = lfirst(i); List *indexqual = lfirst(i);
...@@ -1190,13 +1196,16 @@ fix_indxqual_references(List *indexquals, IndexPath *index_path, ...@@ -1190,13 +1196,16 @@ fix_indxqual_references(List *indexquals, IndexPath *index_path,
List *fixed_qual; List *fixed_qual;
List *recheck_qual; List *recheck_qual;
List *strategy; List *strategy;
List *subtype;
fix_indxqual_sublist(indexqual, baserelids, baserelid, index, fix_indxqual_sublist(indexqual, baserelids, baserelid, index,
&fixed_qual, &recheck_qual, &strategy); &fixed_qual, &recheck_qual,
&strategy, &subtype);
FastAppend(&fixed_quals, fixed_qual); FastAppend(&fixed_quals, fixed_qual);
if (recheck_qual != NIL) if (recheck_qual != NIL)
FastAppend(&recheck_quals, recheck_qual); FastAppend(&recheck_quals, recheck_qual);
*indxstrategy = lappend(*indxstrategy, strategy); *indxstrategy = lappend(*indxstrategy, strategy);
*indxsubtype = lappend(*indxsubtype, subtype);
ixinfo = lnext(ixinfo); ixinfo = lnext(ixinfo);
} }
...@@ -1211,12 +1220,15 @@ fix_indxqual_references(List *indexquals, IndexPath *index_path, ...@@ -1211,12 +1220,15 @@ fix_indxqual_references(List *indexquals, IndexPath *index_path,
* For each qual clause, commute if needed to put the indexkey operand on the * For each qual clause, commute if needed to put the indexkey operand on the
* left, and then fix its varattno. (We do not need to change the other side * left, and then fix its varattno. (We do not need to change the other side
* of the clause.) Also change the operator if necessary, check for * of the clause.) Also change the operator if necessary, check for
* lossy index behavior, and determine the operator's strategy number. * lossy index behavior, and determine the operator's strategy number and
* subtype number.
* *
* Returns three lists: the list of fixed indexquals, the list (usually * Returns four lists:
* empty) of original clauses that must be rechecked as qpquals because * the list of fixed indexquals
* the index is lossy for this operator type, and the integer list of * the list (usually empty) of original clauses that must be rechecked
* strategy numbers. * as qpquals because the index is lossy for this operator type
* the integer list of strategy numbers
* the OID list of strategy subtypes
*/ */
static void static void
fix_indxqual_sublist(List *indexqual, fix_indxqual_sublist(List *indexqual,
...@@ -1224,7 +1236,8 @@ fix_indxqual_sublist(List *indexqual, ...@@ -1224,7 +1236,8 @@ fix_indxqual_sublist(List *indexqual,
IndexOptInfo *index, IndexOptInfo *index,
List **fixed_quals, List **fixed_quals,
List **recheck_quals, List **recheck_quals,
List **strategy) List **strategy,
List **subtype)
{ {
FastList fixed_qual; FastList fixed_qual;
FastList recheck_qual; FastList recheck_qual;
...@@ -1233,6 +1246,7 @@ fix_indxqual_sublist(List *indexqual, ...@@ -1233,6 +1246,7 @@ fix_indxqual_sublist(List *indexqual,
FastListInit(&fixed_qual); FastListInit(&fixed_qual);
FastListInit(&recheck_qual); FastListInit(&recheck_qual);
*strategy = NIL; *strategy = NIL;
*subtype = NIL;
foreach(i, indexqual) foreach(i, indexqual)
{ {
OpExpr *clause = (OpExpr *) lfirst(i); OpExpr *clause = (OpExpr *) lfirst(i);
...@@ -1240,6 +1254,7 @@ fix_indxqual_sublist(List *indexqual, ...@@ -1240,6 +1254,7 @@ fix_indxqual_sublist(List *indexqual,
Relids leftvarnos; Relids leftvarnos;
Oid opclass; Oid opclass;
int stratno; int stratno;
Oid stratsubtype;
bool recheck; bool recheck;
if (!IsA(clause, OpExpr) || if (!IsA(clause, OpExpr) ||
...@@ -1278,13 +1293,14 @@ fix_indxqual_sublist(List *indexqual, ...@@ -1278,13 +1293,14 @@ fix_indxqual_sublist(List *indexqual,
/* /*
* Look up the operator in the operator class to get its strategy * Look up the operator in the operator class to get its strategy
* number and the recheck indicator. This also double-checks that * numbers and the recheck indicator. This also double-checks that
* we found an operator matching the index. * we found an operator matching the index.
*/ */
get_op_opclass_properties(newclause->opno, opclass, get_op_opclass_properties(newclause->opno, opclass,
&stratno, &recheck); &stratno, &stratsubtype, &recheck);
*strategy = lappendi(*strategy, stratno); *strategy = lappendi(*strategy, stratno);
*subtype = lappendo(*subtype, stratsubtype);
/* /*
* If index is lossy for this operator, add (a copy of) original form * If index is lossy for this operator, add (a copy of) original form
...@@ -1540,6 +1556,7 @@ make_indexscan(List *qptlist, ...@@ -1540,6 +1556,7 @@ make_indexscan(List *qptlist,
List *indxqual, List *indxqual,
List *indxqualorig, List *indxqualorig,
List *indxstrategy, List *indxstrategy,
List *indxsubtype,
ScanDirection indexscandir) ScanDirection indexscandir)
{ {
IndexScan *node = makeNode(IndexScan); IndexScan *node = makeNode(IndexScan);
...@@ -1555,6 +1572,7 @@ make_indexscan(List *qptlist, ...@@ -1555,6 +1572,7 @@ make_indexscan(List *qptlist,
node->indxqual = indxqual; node->indxqual = indxqual;
node->indxqualorig = indxqualorig; node->indxqualorig = indxqualorig;
node->indxstrategy = indxstrategy; node->indxstrategy = indxstrategy;
node->indxsubtype = indxsubtype;
node->indxorderdir = indexscandir; node->indxorderdir = indexscandir;
return node; return node;
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/optimizer/util/plancat.c,v 1.88 2003/11/09 21:30:37 tgl Exp $ * $Header: /cvsroot/pgsql/src/backend/optimizer/util/plancat.c,v 1.89 2003/11/12 21:15:54 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -23,7 +23,6 @@ ...@@ -23,7 +23,6 @@
#include "catalog/pg_amop.h" #include "catalog/pg_amop.h"
#include "catalog/pg_inherits.h" #include "catalog/pg_inherits.h"
#include "catalog/pg_index.h" #include "catalog/pg_index.h"
#include "catalog/pg_type.h"
#include "nodes/makefuncs.h" #include "nodes/makefuncs.h"
#include "optimizer/clauses.h" #include "optimizer/clauses.h"
#include "optimizer/plancat.h" #include "optimizer/plancat.h"
...@@ -329,10 +328,10 @@ find_inheritance_children(Oid inhparent) ...@@ -329,10 +328,10 @@ find_inheritance_children(Oid inhparent)
if (!has_subclass(inhparent)) if (!has_subclass(inhparent))
return NIL; return NIL;
ScanKeyEntryInitialize(&key[0], 0, ScanKeyInit(&key[0],
Anum_pg_inherits_inhparent, Anum_pg_inherits_inhparent,
BTEqualStrategyNumber, F_OIDEQ, BTEqualStrategyNumber, F_OIDEQ,
ObjectIdGetDatum(inhparent), OIDOID); ObjectIdGetDatum(inhparent));
relation = heap_openr(InheritsRelationName, AccessShareLock); relation = heap_openr(InheritsRelationName, AccessShareLock);
scan = heap_beginscan(relation, SnapshotNow, 1, key); scan = heap_beginscan(relation, SnapshotNow, 1, key);
while ((inheritsTuple = heap_getnext(scan, ForwardScanDirection)) != NULL) while ((inheritsTuple = heap_getnext(scan, ForwardScanDirection)) != NULL)
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/parser/parse_func.c,v 1.162 2003/11/09 21:30:37 tgl Exp $ * $Header: /cvsroot/pgsql/src/backend/parser/parse_func.c,v 1.163 2003/11/12 21:15:54 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -1039,10 +1039,10 @@ find_inheritors(Oid relid, Oid **supervec) ...@@ -1039,10 +1039,10 @@ find_inheritors(Oid relid, Oid **supervec)
{ {
/* find all types this relid inherits from, and add them to queue */ /* find all types this relid inherits from, and add them to queue */
ScanKeyEntryInitialize(&skey, 0, ScanKeyInit(&skey,
Anum_pg_inherits_inhrelid, Anum_pg_inherits_inhrelid,
BTEqualStrategyNumber, F_OIDEQ, BTEqualStrategyNumber, F_OIDEQ,
ObjectIdGetDatum(relid), OIDOID); ObjectIdGetDatum(relid));
inhscan = heap_beginscan(inhrel, SnapshotNow, 1, &skey); inhscan = heap_beginscan(inhrel, SnapshotNow, 1, &skey);
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/rewrite/rewriteRemove.c,v 1.57 2003/11/09 21:30:37 tgl Exp $ * $Header: /cvsroot/pgsql/src/backend/rewrite/rewriteRemove.c,v 1.58 2003/11/12 21:15:54 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -20,7 +20,6 @@ ...@@ -20,7 +20,6 @@
#include "catalog/dependency.h" #include "catalog/dependency.h"
#include "catalog/indexing.h" #include "catalog/indexing.h"
#include "catalog/pg_rewrite.h" #include "catalog/pg_rewrite.h"
#include "catalog/pg_type.h"
#include "miscadmin.h" #include "miscadmin.h"
#include "rewrite/rewriteRemove.h" #include "rewrite/rewriteRemove.h"
#include "rewrite/rewriteSupport.h" #include "rewrite/rewriteSupport.h"
...@@ -105,10 +104,10 @@ RemoveRewriteRuleById(Oid ruleOid) ...@@ -105,10 +104,10 @@ RemoveRewriteRuleById(Oid ruleOid)
/* /*
* Find the tuple for the target rule. * Find the tuple for the target rule.
*/ */
ScanKeyEntryInitialize(&skey[0], 0, ScanKeyInit(&skey[0],
ObjectIdAttributeNumber, ObjectIdAttributeNumber,
BTEqualStrategyNumber, F_OIDEQ, BTEqualStrategyNumber, F_OIDEQ,
ObjectIdGetDatum(ruleOid), OIDOID); ObjectIdGetDatum(ruleOid));
rcscan = systable_beginscan(RewriteRelation, RewriteOidIndex, true, rcscan = systable_beginscan(RewriteRelation, RewriteOidIndex, true,
SnapshotNow, 1, skey); SnapshotNow, 1, skey);
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/storage/large_object/inv_api.c,v 1.99 2003/11/09 21:30:37 tgl Exp $ * $Header: /cvsroot/pgsql/src/backend/storage/large_object/inv_api.c,v 1.100 2003/11/12 21:15:54 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -202,10 +202,10 @@ inv_getsize(LargeObjectDesc *obj_desc) ...@@ -202,10 +202,10 @@ inv_getsize(LargeObjectDesc *obj_desc)
Assert(PointerIsValid(obj_desc)); Assert(PointerIsValid(obj_desc));
ScanKeyEntryInitialize(&skey[0], 0, ScanKeyInit(&skey[0],
Anum_pg_largeobject_loid, Anum_pg_largeobject_loid,
BTEqualStrategyNumber, F_OIDEQ, BTEqualStrategyNumber, F_OIDEQ,
ObjectIdGetDatum(obj_desc->id), OIDOID); ObjectIdGetDatum(obj_desc->id));
sd = index_beginscan(obj_desc->heap_r, obj_desc->index_r, sd = index_beginscan(obj_desc->heap_r, obj_desc->index_r,
SnapshotNow, 1, skey); SnapshotNow, 1, skey);
...@@ -306,15 +306,15 @@ inv_read(LargeObjectDesc *obj_desc, char *buf, int nbytes) ...@@ -306,15 +306,15 @@ inv_read(LargeObjectDesc *obj_desc, char *buf, int nbytes)
if (nbytes <= 0) if (nbytes <= 0)
return 0; return 0;
ScanKeyEntryInitialize(&skey[0], 0, ScanKeyInit(&skey[0],
Anum_pg_largeobject_loid, Anum_pg_largeobject_loid,
BTEqualStrategyNumber, F_OIDEQ, BTEqualStrategyNumber, F_OIDEQ,
ObjectIdGetDatum(obj_desc->id), OIDOID); ObjectIdGetDatum(obj_desc->id));
ScanKeyEntryInitialize(&skey[1], 0, ScanKeyInit(&skey[1],
Anum_pg_largeobject_pageno, Anum_pg_largeobject_pageno,
BTGreaterEqualStrategyNumber, F_INT4GE, BTGreaterEqualStrategyNumber, F_INT4GE,
Int32GetDatum(pageno), INT4OID); Int32GetDatum(pageno));
sd = index_beginscan(obj_desc->heap_r, obj_desc->index_r, sd = index_beginscan(obj_desc->heap_r, obj_desc->index_r,
SnapshotNow, 2, skey); SnapshotNow, 2, skey);
...@@ -413,15 +413,15 @@ inv_write(LargeObjectDesc *obj_desc, char *buf, int nbytes) ...@@ -413,15 +413,15 @@ inv_write(LargeObjectDesc *obj_desc, char *buf, int nbytes)
indstate = CatalogOpenIndexes(obj_desc->heap_r); indstate = CatalogOpenIndexes(obj_desc->heap_r);
ScanKeyEntryInitialize(&skey[0], 0, ScanKeyInit(&skey[0],
Anum_pg_largeobject_loid, Anum_pg_largeobject_loid,
BTEqualStrategyNumber, F_OIDEQ, BTEqualStrategyNumber, F_OIDEQ,
ObjectIdGetDatum(obj_desc->id), OIDOID); ObjectIdGetDatum(obj_desc->id));
ScanKeyEntryInitialize(&skey[1], 0, ScanKeyInit(&skey[1],
Anum_pg_largeobject_pageno, Anum_pg_largeobject_pageno,
BTGreaterEqualStrategyNumber, F_INT4GE, BTGreaterEqualStrategyNumber, F_INT4GE,
Int32GetDatum(pageno), INT4OID); Int32GetDatum(pageno));
sd = index_beginscan(obj_desc->heap_r, obj_desc->index_r, sd = index_beginscan(obj_desc->heap_r, obj_desc->index_r,
SnapshotNow, 2, skey); SnapshotNow, 2, skey);
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/adt/float.c,v 1.94 2003/09/25 06:58:03 petere Exp $ * $Header: /cvsroot/pgsql/src/backend/utils/adt/float.c,v 1.95 2003/11/12 21:15:54 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -839,6 +839,26 @@ btfloat8cmp(PG_FUNCTION_ARGS) ...@@ -839,6 +839,26 @@ btfloat8cmp(PG_FUNCTION_ARGS)
PG_RETURN_INT32(float8_cmp_internal(arg1, arg2)); PG_RETURN_INT32(float8_cmp_internal(arg1, arg2));
} }
Datum
btfloat48cmp(PG_FUNCTION_ARGS)
{
float4 arg1 = PG_GETARG_FLOAT4(0);
float8 arg2 = PG_GETARG_FLOAT8(1);
/* widen float4 to float8 and then compare */
PG_RETURN_INT32(float8_cmp_internal(arg1, arg2));
}
Datum
btfloat84cmp(PG_FUNCTION_ARGS)
{
float8 arg1 = PG_GETARG_FLOAT8(0);
float4 arg2 = PG_GETARG_FLOAT4(1);
/* widen float4 to float8 and then compare */
PG_RETURN_INT32(float8_cmp_internal(arg1, arg2));
}
/* /*
* =================== * ===================
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/adt/regproc.c,v 1.83 2003/11/09 21:30:37 tgl Exp $ * $Header: /cvsroot/pgsql/src/backend/utils/adt/regproc.c,v 1.84 2003/11/12 21:15:54 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -92,10 +92,10 @@ regprocin(PG_FUNCTION_ARGS) ...@@ -92,10 +92,10 @@ regprocin(PG_FUNCTION_ARGS)
SysScanDesc sysscan; SysScanDesc sysscan;
HeapTuple tuple; HeapTuple tuple;
ScanKeyEntryInitialize(&skey[0], 0, ScanKeyInit(&skey[0],
Anum_pg_proc_proname, Anum_pg_proc_proname,
BTEqualStrategyNumber, F_NAMEEQ, BTEqualStrategyNumber, F_NAMEEQ,
CStringGetDatum(pro_name_or_oid), NAMEOID); CStringGetDatum(pro_name_or_oid));
hdesc = heap_openr(ProcedureRelationName, AccessShareLock); hdesc = heap_openr(ProcedureRelationName, AccessShareLock);
sysscan = systable_beginscan(hdesc, ProcedureNameNspIndex, true, sysscan = systable_beginscan(hdesc, ProcedureNameNspIndex, true,
...@@ -442,10 +442,10 @@ regoperin(PG_FUNCTION_ARGS) ...@@ -442,10 +442,10 @@ regoperin(PG_FUNCTION_ARGS)
SysScanDesc sysscan; SysScanDesc sysscan;
HeapTuple tuple; HeapTuple tuple;
ScanKeyEntryInitialize(&skey[0], 0, ScanKeyInit(&skey[0],
Anum_pg_operator_oprname, Anum_pg_operator_oprname,
BTEqualStrategyNumber, F_NAMEEQ, BTEqualStrategyNumber, F_NAMEEQ,
CStringGetDatum(opr_name_or_oid), NAMEOID); CStringGetDatum(opr_name_or_oid));
hdesc = heap_openr(OperatorRelationName, AccessShareLock); hdesc = heap_openr(OperatorRelationName, AccessShareLock);
sysscan = systable_beginscan(hdesc, OperatorNameNspIndex, true, sysscan = systable_beginscan(hdesc, OperatorNameNspIndex, true,
...@@ -820,10 +820,10 @@ regclassin(PG_FUNCTION_ARGS) ...@@ -820,10 +820,10 @@ regclassin(PG_FUNCTION_ARGS)
SysScanDesc sysscan; SysScanDesc sysscan;
HeapTuple tuple; HeapTuple tuple;
ScanKeyEntryInitialize(&skey[0], 0, ScanKeyInit(&skey[0],
Anum_pg_class_relname, Anum_pg_class_relname,
BTEqualStrategyNumber, F_NAMEEQ, BTEqualStrategyNumber, F_NAMEEQ,
CStringGetDatum(class_name_or_oid), NAMEOID); CStringGetDatum(class_name_or_oid));
hdesc = heap_openr(RelationRelationName, AccessShareLock); hdesc = heap_openr(RelationRelationName, AccessShareLock);
sysscan = systable_beginscan(hdesc, ClassNameNspIndex, true, sysscan = systable_beginscan(hdesc, ClassNameNspIndex, true,
...@@ -986,10 +986,10 @@ regtypein(PG_FUNCTION_ARGS) ...@@ -986,10 +986,10 @@ regtypein(PG_FUNCTION_ARGS)
SysScanDesc sysscan; SysScanDesc sysscan;
HeapTuple tuple; HeapTuple tuple;
ScanKeyEntryInitialize(&skey[0], 0, ScanKeyInit(&skey[0],
Anum_pg_type_typname, Anum_pg_type_typname,
BTEqualStrategyNumber, F_NAMEEQ, BTEqualStrategyNumber, F_NAMEEQ,
CStringGetDatum(typ_name_or_oid), NAMEOID); CStringGetDatum(typ_name_or_oid));
hdesc = heap_openr(TypeRelationName, AccessShareLock); hdesc = heap_openr(TypeRelationName, AccessShareLock);
sysscan = systable_beginscan(hdesc, TypeNameNspIndex, true, sysscan = systable_beginscan(hdesc, TypeNameNspIndex, true,
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* back to source text * back to source text
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/adt/ruleutils.c,v 1.158 2003/11/09 21:30:37 tgl Exp $ * $Header: /cvsroot/pgsql/src/backend/utils/adt/ruleutils.c,v 1.159 2003/11/12 21:15:55 tgl Exp $
* *
* This software is copyrighted by Jan Wieck - Hamburg. * This software is copyrighted by Jan Wieck - Hamburg.
* *
...@@ -488,10 +488,10 @@ pg_get_triggerdef(PG_FUNCTION_ARGS) ...@@ -488,10 +488,10 @@ pg_get_triggerdef(PG_FUNCTION_ARGS)
*/ */
tgrel = heap_openr(TriggerRelationName, AccessShareLock); tgrel = heap_openr(TriggerRelationName, AccessShareLock);
ScanKeyEntryInitialize(&skey[0], 0, ScanKeyInit(&skey[0],
ObjectIdAttributeNumber, ObjectIdAttributeNumber,
BTEqualStrategyNumber, F_OIDEQ, BTEqualStrategyNumber, F_OIDEQ,
ObjectIdGetDatum(trigid), OIDOID); ObjectIdGetDatum(trigid));
tgscan = systable_beginscan(tgrel, TriggerOidIndex, true, tgscan = systable_beginscan(tgrel, TriggerOidIndex, true,
SnapshotNow, 1, skey); SnapshotNow, 1, skey);
...@@ -886,10 +886,10 @@ pg_get_constraintdef_worker(Oid constraintId, int prettyFlags) ...@@ -886,10 +886,10 @@ pg_get_constraintdef_worker(Oid constraintId, int prettyFlags)
*/ */
conDesc = heap_openr(ConstraintRelationName, AccessShareLock); conDesc = heap_openr(ConstraintRelationName, AccessShareLock);
ScanKeyEntryInitialize(&skey[0], 0, ScanKeyInit(&skey[0],
ObjectIdAttributeNumber, ObjectIdAttributeNumber,
BTEqualStrategyNumber, F_OIDEQ, BTEqualStrategyNumber, F_OIDEQ,
ObjectIdGetDatum(constraintId), OIDOID); ObjectIdGetDatum(constraintId));
conscan = systable_beginscan(conDesc, ConstraintOidIndex, true, conscan = systable_beginscan(conDesc, ConstraintOidIndex, true,
SnapshotNow, 1, skey); SnapshotNow, 1, skey);
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/adt/selfuncs.c,v 1.147 2003/10/16 21:37:54 tgl Exp $ * $Header: /cvsroot/pgsql/src/backend/utils/adt/selfuncs.c,v 1.148 2003/11/12 21:15:55 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -952,7 +952,8 @@ patternsel(PG_FUNCTION_ARGS, Pattern_Type ptype) ...@@ -952,7 +952,8 @@ patternsel(PG_FUNCTION_ARGS, Pattern_Type ptype)
/* /*
* Pattern specifies an exact match, so pretend operator is '=' * Pattern specifies an exact match, so pretend operator is '='
*/ */
Oid eqopr = get_opclass_member(opclass, BTEqualStrategyNumber); Oid eqopr = get_opclass_member(opclass, InvalidOid,
BTEqualStrategyNumber);
List *eqargs; List *eqargs;
if (eqopr == InvalidOid) if (eqopr == InvalidOid)
...@@ -3382,7 +3383,8 @@ prefix_selectivity(Query *root, Var *var, Oid opclass, Const *prefixcon) ...@@ -3382,7 +3383,8 @@ prefix_selectivity(Query *root, Var *var, Oid opclass, Const *prefixcon)
List *cmpargs; List *cmpargs;
Const *greaterstrcon; Const *greaterstrcon;
cmpopr = get_opclass_member(opclass, BTGreaterEqualStrategyNumber); cmpopr = get_opclass_member(opclass, InvalidOid,
BTGreaterEqualStrategyNumber);
if (cmpopr == InvalidOid) if (cmpopr == InvalidOid)
elog(ERROR, "no >= operator for opclass %u", opclass); elog(ERROR, "no >= operator for opclass %u", opclass);
cmpargs = makeList2(var, prefixcon); cmpargs = makeList2(var, prefixcon);
...@@ -3403,7 +3405,8 @@ prefix_selectivity(Query *root, Var *var, Oid opclass, Const *prefixcon) ...@@ -3403,7 +3405,8 @@ prefix_selectivity(Query *root, Var *var, Oid opclass, Const *prefixcon)
{ {
Selectivity topsel; Selectivity topsel;
cmpopr = get_opclass_member(opclass, BTLessStrategyNumber); cmpopr = get_opclass_member(opclass, InvalidOid,
BTLessStrategyNumber);
if (cmpopr == InvalidOid) if (cmpopr == InvalidOid)
elog(ERROR, "no < operator for opclass %u", opclass); elog(ERROR, "no < operator for opclass %u", opclass);
cmpargs = makeList2(var, greaterstrcon); cmpargs = makeList2(var, greaterstrcon);
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/cache/catcache.c,v 1.109 2003/11/09 21:30:37 tgl Exp $ * $Header: /cvsroot/pgsql/src/backend/utils/cache/catcache.c,v 1.110 2003/11/12 21:15:55 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -967,9 +967,9 @@ CatalogCacheInitializeCache(CatCache *cache) ...@@ -967,9 +967,9 @@ CatalogCacheInitializeCache(CatCache *cache)
/* Initialize sk_attno suitably for HeapKeyTest() and heap scans */ /* Initialize sk_attno suitably for HeapKeyTest() and heap scans */
cache->cc_skey[i].sk_attno = cache->cc_key[i]; cache->cc_skey[i].sk_attno = cache->cc_key[i];
/* Fill in sk_strategy and sk_argtype correctly as well */ /* Fill in sk_strategy as well --- always standard equality */
cache->cc_skey[i].sk_strategy = BTEqualStrategyNumber; cache->cc_skey[i].sk_strategy = BTEqualStrategyNumber;
cache->cc_skey[i].sk_argtype = keytype; cache->cc_skey[i].sk_subtype = InvalidOid;
CACHE4_elog(DEBUG2, "CatalogCacheInit %s %d %p", CACHE4_elog(DEBUG2, "CatalogCacheInit %s %d %p",
cache->cc_relname, cache->cc_relname,
......
...@@ -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/utils/cache/lsyscache.c,v 1.109 2003/11/09 21:30:37 tgl Exp $ * $Header: /cvsroot/pgsql/src/backend/utils/cache/lsyscache.c,v 1.110 2003/11/12 21:15:55 tgl Exp $
* *
* NOTES * NOTES
* Eventually, the index information should go through here, too. * Eventually, the index information should go through here, too.
...@@ -55,7 +55,7 @@ op_in_opclass(Oid opno, Oid opclass) ...@@ -55,7 +55,7 @@ op_in_opclass(Oid opno, Oid opclass)
/* /*
* get_op_opclass_properties * get_op_opclass_properties
* *
* Get the operator's strategy number and recheck (lossy) flag * Get the operator's strategy number, subtype, and recheck (lossy) flag
* within the specified opclass. * within the specified opclass.
* *
* Caller should already have verified that opno is a member of opclass, * Caller should already have verified that opno is a member of opclass,
...@@ -63,7 +63,7 @@ op_in_opclass(Oid opno, Oid opclass) ...@@ -63,7 +63,7 @@ op_in_opclass(Oid opno, Oid opclass)
*/ */
void void
get_op_opclass_properties(Oid opno, Oid opclass, get_op_opclass_properties(Oid opno, Oid opclass,
int *strategy, bool *recheck) int *strategy, Oid *subtype, bool *recheck)
{ {
HeapTuple tp; HeapTuple tp;
Form_pg_amop amop_tup; Form_pg_amop amop_tup;
...@@ -77,6 +77,7 @@ get_op_opclass_properties(Oid opno, Oid opclass, ...@@ -77,6 +77,7 @@ get_op_opclass_properties(Oid opno, Oid opclass,
opno, opclass); opno, opclass);
amop_tup = (Form_pg_amop) GETSTRUCT(tp); amop_tup = (Form_pg_amop) GETSTRUCT(tp);
*strategy = amop_tup->amopstrategy; *strategy = amop_tup->amopstrategy;
*subtype = amop_tup->amopsubtype;
*recheck = amop_tup->amopreqcheck; *recheck = amop_tup->amopreqcheck;
ReleaseSysCache(tp); ReleaseSysCache(tp);
} }
...@@ -84,12 +85,12 @@ get_op_opclass_properties(Oid opno, Oid opclass, ...@@ -84,12 +85,12 @@ get_op_opclass_properties(Oid opno, Oid opclass,
/* /*
* get_opclass_member * get_opclass_member
* Get the OID of the operator that implements the specified strategy * Get the OID of the operator that implements the specified strategy
* for the specified opclass. * with the specified subtype for the specified opclass.
* *
* Returns InvalidOid if there is no pg_amop entry for the given keys. * Returns InvalidOid if there is no pg_amop entry for the given keys.
*/ */
Oid Oid
get_opclass_member(Oid opclass, int16 strategy) get_opclass_member(Oid opclass, Oid subtype, int16 strategy)
{ {
HeapTuple tp; HeapTuple tp;
Form_pg_amop amop_tup; Form_pg_amop amop_tup;
...@@ -97,8 +98,9 @@ get_opclass_member(Oid opclass, int16 strategy) ...@@ -97,8 +98,9 @@ get_opclass_member(Oid opclass, int16 strategy)
tp = SearchSysCache(AMOPSTRATEGY, tp = SearchSysCache(AMOPSTRATEGY,
ObjectIdGetDatum(opclass), ObjectIdGetDatum(opclass),
ObjectIdGetDatum(subtype),
Int16GetDatum(strategy), Int16GetDatum(strategy),
0, 0); 0);
if (!HeapTupleIsValid(tp)) if (!HeapTupleIsValid(tp))
return InvalidOid; return InvalidOid;
amop_tup = (Form_pg_amop) GETSTRUCT(tp); amop_tup = (Form_pg_amop) GETSTRUCT(tp);
...@@ -149,8 +151,8 @@ get_op_hash_function(Oid opno) ...@@ -149,8 +151,8 @@ get_op_hash_function(Oid opno)
if (OidIsValid(opclass)) if (OidIsValid(opclass))
{ {
/* Found a suitable opclass, get its hash support function */ /* Found a suitable opclass, get its default hash support function */
return get_opclass_proc(opclass, HASHPROC); return get_opclass_proc(opclass, InvalidOid, HASHPROC);
} }
/* Didn't find a match... */ /* Didn't find a match... */
...@@ -163,12 +165,12 @@ get_op_hash_function(Oid opno) ...@@ -163,12 +165,12 @@ get_op_hash_function(Oid opno)
/* /*
* get_opclass_proc * get_opclass_proc
* Get the OID of the specified support function * Get the OID of the specified support function
* for the specified opclass. * for the specified opclass and subtype.
* *
* Returns InvalidOid if there is no pg_amproc entry for the given keys. * Returns InvalidOid if there is no pg_amproc entry for the given keys.
*/ */
Oid Oid
get_opclass_proc(Oid opclass, int16 procnum) get_opclass_proc(Oid opclass, Oid subtype, int16 procnum)
{ {
HeapTuple tp; HeapTuple tp;
Form_pg_amproc amproc_tup; Form_pg_amproc amproc_tup;
...@@ -176,8 +178,9 @@ get_opclass_proc(Oid opclass, int16 procnum) ...@@ -176,8 +178,9 @@ get_opclass_proc(Oid opclass, int16 procnum)
tp = SearchSysCache(AMPROCNUM, tp = SearchSysCache(AMPROCNUM,
ObjectIdGetDatum(opclass), ObjectIdGetDatum(opclass),
ObjectIdGetDatum(subtype),
Int16GetDatum(procnum), Int16GetDatum(procnum),
0, 0); 0);
if (!HeapTupleIsValid(tp)) if (!HeapTupleIsValid(tp))
return InvalidOid; return InvalidOid;
amproc_tup = (Form_pg_amproc) GETSTRUCT(tp); amproc_tup = (Form_pg_amproc) GETSTRUCT(tp);
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/cache/relcache.c,v 1.191 2003/11/09 21:30:37 tgl Exp $ * $Header: /cvsroot/pgsql/src/backend/utils/cache/relcache.c,v 1.192 2003/11/12 21:15:56 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -262,7 +262,7 @@ do { \ ...@@ -262,7 +262,7 @@ do { \
/* /*
* Special cache for opclass-related information * Special cache for opclass-related information
* *
* Note: only non-cross-type operators and support procs get cached * Note: only default-subtype operators and support procs get cached
*/ */
typedef struct opclasscacheent typedef struct opclasscacheent
{ {
...@@ -336,26 +336,23 @@ ScanPgRelation(RelationBuildDescInfo buildinfo, bool indexOK) ...@@ -336,26 +336,23 @@ ScanPgRelation(RelationBuildDescInfo buildinfo, bool indexOK)
switch (buildinfo.infotype) switch (buildinfo.infotype)
{ {
case INFO_RELID: case INFO_RELID:
ScanKeyEntryInitialize(&key[0], 0, ScanKeyInit(&key[0],
ObjectIdAttributeNumber, ObjectIdAttributeNumber,
BTEqualStrategyNumber, F_OIDEQ, BTEqualStrategyNumber, F_OIDEQ,
ObjectIdGetDatum(buildinfo.i.info_id), ObjectIdGetDatum(buildinfo.i.info_id));
OIDOID);
nkeys = 1; nkeys = 1;
indexRelname = ClassOidIndex; indexRelname = ClassOidIndex;
break; break;
case INFO_RELNAME: case INFO_RELNAME:
ScanKeyEntryInitialize(&key[0], 0, ScanKeyInit(&key[0],
Anum_pg_class_relname, Anum_pg_class_relname,
BTEqualStrategyNumber, F_NAMEEQ, BTEqualStrategyNumber, F_NAMEEQ,
NameGetDatum(buildinfo.i.info_name), NameGetDatum(buildinfo.i.info_name));
NAMEOID); ScanKeyInit(&key[1],
ScanKeyEntryInitialize(&key[1], 0, Anum_pg_class_relnamespace,
Anum_pg_class_relnamespace, BTEqualStrategyNumber, F_OIDEQ,
BTEqualStrategyNumber, F_OIDEQ, ObjectIdGetDatum(PG_CATALOG_NAMESPACE));
ObjectIdGetDatum(PG_CATALOG_NAMESPACE),
OIDOID);
nkeys = 2; nkeys = 2;
indexRelname = ClassNameNspIndex; indexRelname = ClassNameNspIndex;
break; break;
...@@ -483,15 +480,14 @@ RelationBuildTupleDesc(RelationBuildDescInfo buildinfo, ...@@ -483,15 +480,14 @@ RelationBuildTupleDesc(RelationBuildDescInfo buildinfo,
* (Eliminating system attribute rows at the index level is lots * (Eliminating system attribute rows at the index level is lots
* faster than fetching them.) * faster than fetching them.)
*/ */
ScanKeyEntryInitialize(&skey[0], 0, ScanKeyInit(&skey[0],
Anum_pg_attribute_attrelid, Anum_pg_attribute_attrelid,
BTEqualStrategyNumber, F_OIDEQ, BTEqualStrategyNumber, F_OIDEQ,
ObjectIdGetDatum(RelationGetRelid(relation)), ObjectIdGetDatum(RelationGetRelid(relation)));
OIDOID); ScanKeyInit(&skey[1],
ScanKeyEntryInitialize(&skey[1], 0, Anum_pg_attribute_attnum,
Anum_pg_attribute_attnum, BTGreaterStrategyNumber, F_INT2GT,
BTGreaterStrategyNumber, F_INT2GT, Int16GetDatum(0));
Int16GetDatum(0), INT2OID);
/* /*
* Open pg_attribute and begin a scan. Force heap scan if we haven't * Open pg_attribute and begin a scan. Force heap scan if we haven't
...@@ -673,11 +669,10 @@ RelationBuildRuleLock(Relation relation) ...@@ -673,11 +669,10 @@ RelationBuildRuleLock(Relation relation)
/* /*
* form a scan key * form a scan key
*/ */
ScanKeyEntryInitialize(&key, 0, ScanKeyInit(&key,
Anum_pg_rewrite_ev_class, Anum_pg_rewrite_ev_class,
BTEqualStrategyNumber, F_OIDEQ, BTEqualStrategyNumber, F_OIDEQ,
ObjectIdGetDatum(RelationGetRelid(relation)), ObjectIdGetDatum(RelationGetRelid(relation)));
OIDOID);
/* /*
* open pg_rewrite and begin a scan * open pg_rewrite and begin a scan
...@@ -1058,7 +1053,7 @@ RelationInitIndexAccessInfo(Relation relation) ...@@ -1058,7 +1053,7 @@ RelationInitIndexAccessInfo(Relation relation)
/* /*
* IndexSupportInitialize * IndexSupportInitialize
* Initializes an index's cached lists of operators and support procs, * Initializes an index's cached opclass information,
* given the index's pg_index tuple. * given the index's pg_index tuple.
* *
* Data is returned into *indexOperator and *indexSupport, which are arrays * Data is returned into *indexOperator and *indexSupport, which are arrays
...@@ -1131,11 +1126,9 @@ LookupOpclassInfo(Oid operatorClassOid, ...@@ -1131,11 +1126,9 @@ LookupOpclassInfo(Oid operatorClassOid,
{ {
OpClassCacheEnt *opcentry; OpClassCacheEnt *opcentry;
bool found; bool found;
Relation pg_amop_desc; Relation rel;
Relation pg_amproc_desc; SysScanDesc scan;
SysScanDesc pg_amop_scan; ScanKeyData skey[2];
SysScanDesc pg_amproc_scan;
ScanKeyData key;
HeapTuple htup; HeapTuple htup;
bool indexOK; bool indexOK;
...@@ -1191,7 +1184,7 @@ LookupOpclassInfo(Oid operatorClassOid, ...@@ -1191,7 +1184,7 @@ LookupOpclassInfo(Oid operatorClassOid,
opcentry->supportProcs = NULL; opcentry->supportProcs = NULL;
/* /*
* To avoid infinite recursion during startup, force a heap scan if * To avoid infinite recursion during startup, force heap scans if
* we're looking up info for the opclasses used by the indexes we * we're looking up info for the opclasses used by the indexes we
* would like to reference here. * would like to reference here.
*/ */
...@@ -1200,24 +1193,25 @@ LookupOpclassInfo(Oid operatorClassOid, ...@@ -1200,24 +1193,25 @@ LookupOpclassInfo(Oid operatorClassOid,
operatorClassOid != INT2_BTREE_OPS_OID); operatorClassOid != INT2_BTREE_OPS_OID);
/* /*
* Scan pg_amop to obtain operators for the opclass * Scan pg_amop to obtain operators for the opclass. We only fetch
* the default ones (those with subtype zero).
*/ */
if (numStrats > 0) if (numStrats > 0)
{ {
ScanKeyEntryInitialize(&key, 0, ScanKeyInit(&skey[0],
Anum_pg_amop_amopclaid, Anum_pg_amop_amopclaid,
BTEqualStrategyNumber, F_OIDEQ, BTEqualStrategyNumber, F_OIDEQ,
ObjectIdGetDatum(operatorClassOid), ObjectIdGetDatum(operatorClassOid));
OIDOID); ScanKeyInit(&skey[1],
pg_amop_desc = heap_openr(AccessMethodOperatorRelationName, Anum_pg_amop_amopsubtype,
AccessShareLock); BTEqualStrategyNumber, F_OIDEQ,
pg_amop_scan = systable_beginscan(pg_amop_desc, ObjectIdGetDatum(InvalidOid));
AccessMethodStrategyIndex, rel = heap_openr(AccessMethodOperatorRelationName,
indexOK, AccessShareLock);
SnapshotNow, scan = systable_beginscan(rel, AccessMethodStrategyIndex, indexOK,
1, &key); SnapshotNow, 2, skey);
while (HeapTupleIsValid(htup = systable_getnext(pg_amop_scan))) while (HeapTupleIsValid(htup = systable_getnext(scan)))
{ {
Form_pg_amop amopform = (Form_pg_amop) GETSTRUCT(htup); Form_pg_amop amopform = (Form_pg_amop) GETSTRUCT(htup);
...@@ -1229,29 +1223,30 @@ LookupOpclassInfo(Oid operatorClassOid, ...@@ -1229,29 +1223,30 @@ LookupOpclassInfo(Oid operatorClassOid,
amopform->amopopr; amopform->amopopr;
} }
systable_endscan(pg_amop_scan); systable_endscan(scan);
heap_close(pg_amop_desc, AccessShareLock); heap_close(rel, AccessShareLock);
} }
/* /*
* Scan pg_amproc to obtain support procs for the opclass * Scan pg_amproc to obtain support procs for the opclass. We only fetch
* the default ones (those with subtype zero).
*/ */
if (numSupport > 0) if (numSupport > 0)
{ {
ScanKeyEntryInitialize(&key, 0, ScanKeyInit(&skey[0],
Anum_pg_amproc_amopclaid, Anum_pg_amproc_amopclaid,
BTEqualStrategyNumber, F_OIDEQ, BTEqualStrategyNumber, F_OIDEQ,
ObjectIdGetDatum(operatorClassOid), ObjectIdGetDatum(operatorClassOid));
OIDOID); ScanKeyInit(&skey[1],
pg_amproc_desc = heap_openr(AccessMethodProcedureRelationName, Anum_pg_amproc_amprocsubtype,
AccessShareLock); BTEqualStrategyNumber, F_OIDEQ,
pg_amproc_scan = systable_beginscan(pg_amproc_desc, ObjectIdGetDatum(InvalidOid));
AccessMethodProcedureIndex, rel = heap_openr(AccessMethodProcedureRelationName,
indexOK, AccessShareLock);
SnapshotNow, scan = systable_beginscan(rel, AccessMethodProcedureIndex, indexOK,
1, &key); SnapshotNow, 2, skey);
while (HeapTupleIsValid(htup = systable_getnext(pg_amproc_scan))) while (HeapTupleIsValid(htup = systable_getnext(scan)))
{ {
Form_pg_amproc amprocform = (Form_pg_amproc) GETSTRUCT(htup); Form_pg_amproc amprocform = (Form_pg_amproc) GETSTRUCT(htup);
...@@ -1264,8 +1259,8 @@ LookupOpclassInfo(Oid operatorClassOid, ...@@ -1264,8 +1259,8 @@ LookupOpclassInfo(Oid operatorClassOid,
amprocform->amproc; amprocform->amproc;
} }
systable_endscan(pg_amproc_scan); systable_endscan(scan);
heap_close(pg_amproc_desc, AccessShareLock); heap_close(rel, AccessShareLock);
} }
opcentry->valid = true; opcentry->valid = true;
...@@ -2483,16 +2478,14 @@ AttrDefaultFetch(Relation relation) ...@@ -2483,16 +2478,14 @@ AttrDefaultFetch(Relation relation)
int found; int found;
int i; int i;
ScanKeyEntryInitialize(&skey, 0, ScanKeyInit(&skey,
Anum_pg_attrdef_adrelid, Anum_pg_attrdef_adrelid,
BTEqualStrategyNumber, F_OIDEQ, BTEqualStrategyNumber, F_OIDEQ,
ObjectIdGetDatum(RelationGetRelid(relation)), ObjectIdGetDatum(RelationGetRelid(relation)));
OIDOID);
adrel = heap_openr(AttrDefaultRelationName, AccessShareLock); adrel = heap_openr(AttrDefaultRelationName, AccessShareLock);
adscan = systable_beginscan(adrel, AttrDefaultIndex, true, adscan = systable_beginscan(adrel, AttrDefaultIndex, true,
SnapshotNow, SnapshotNow, 1, &skey);
1, &skey);
found = 0; found = 0;
while (HeapTupleIsValid(htup = systable_getnext(adscan))) while (HeapTupleIsValid(htup = systable_getnext(adscan)))
...@@ -2550,11 +2543,10 @@ CheckConstraintFetch(Relation relation) ...@@ -2550,11 +2543,10 @@ CheckConstraintFetch(Relation relation)
bool isnull; bool isnull;
int found = 0; int found = 0;
ScanKeyEntryInitialize(&skey[0], 0, ScanKeyInit(&skey[0],
Anum_pg_constraint_conrelid, Anum_pg_constraint_conrelid,
BTEqualStrategyNumber, F_OIDEQ, BTEqualStrategyNumber, F_OIDEQ,
ObjectIdGetDatum(RelationGetRelid(relation)), ObjectIdGetDatum(RelationGetRelid(relation)));
OIDOID);
conrel = heap_openr(ConstraintRelationName, AccessShareLock); conrel = heap_openr(ConstraintRelationName, AccessShareLock);
conscan = systable_beginscan(conrel, ConstraintRelidIndex, true, conscan = systable_beginscan(conrel, ConstraintRelidIndex, true,
...@@ -2642,16 +2634,14 @@ RelationGetIndexList(Relation relation) ...@@ -2642,16 +2634,14 @@ RelationGetIndexList(Relation relation)
result = NIL; result = NIL;
/* Prepare to scan pg_index for entries having indrelid = this rel. */ /* Prepare to scan pg_index for entries having indrelid = this rel. */
ScanKeyEntryInitialize(&skey, 0, ScanKeyInit(&skey,
Anum_pg_index_indrelid, Anum_pg_index_indrelid,
BTEqualStrategyNumber, F_OIDEQ, BTEqualStrategyNumber, F_OIDEQ,
ObjectIdGetDatum(RelationGetRelid(relation)), ObjectIdGetDatum(RelationGetRelid(relation)));
OIDOID);
indrel = heap_openr(IndexRelationName, AccessShareLock); indrel = heap_openr(IndexRelationName, AccessShareLock);
indscan = systable_beginscan(indrel, IndexIndrelidIndex, true, indscan = systable_beginscan(indrel, IndexIndrelidIndex, true,
SnapshotNow, SnapshotNow, 1, &skey);
1, &skey);
while (HeapTupleIsValid(htup = systable_getnext(indscan))) while (HeapTupleIsValid(htup = systable_getnext(indscan)))
{ {
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/cache/syscache.c,v 1.91 2003/09/24 18:54:01 tgl Exp $ * $Header: /cvsroot/pgsql/src/backend/utils/cache/syscache.c,v 1.92 2003/11/12 21:15:56 tgl Exp $
* *
* NOTES * NOTES
* These routines allow the parser/planner/executor to perform * These routines allow the parser/planner/executor to perform
...@@ -136,21 +136,21 @@ static const struct cachedesc cacheinfo[] = { ...@@ -136,21 +136,21 @@ static const struct cachedesc cacheinfo[] = {
{AccessMethodOperatorRelationName, /* AMOPSTRATEGY */ {AccessMethodOperatorRelationName, /* AMOPSTRATEGY */
AccessMethodStrategyIndex, AccessMethodStrategyIndex,
0, 0,
2, 3,
{ {
Anum_pg_amop_amopclaid, Anum_pg_amop_amopclaid,
Anum_pg_amop_amopsubtype,
Anum_pg_amop_amopstrategy, Anum_pg_amop_amopstrategy,
0,
0 0
}}, }},
{AccessMethodProcedureRelationName, /* AMPROCNUM */ {AccessMethodProcedureRelationName, /* AMPROCNUM */
AccessMethodProcedureIndex, AccessMethodProcedureIndex,
0, 0,
2, 3,
{ {
Anum_pg_amproc_amopclaid, Anum_pg_amproc_amopclaid,
Anum_pg_amproc_amprocsubtype,
Anum_pg_amproc_amprocnum, Anum_pg_amproc_amprocnum,
0,
0 0
}}, }},
{AttributeRelationName, /* ATTNAME */ {AttributeRelationName, /* ATTNAME */
......
...@@ -33,7 +33,7 @@ ...@@ -33,7 +33,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/utils/cache/typcache.c,v 1.2 2003/11/09 21:30:37 tgl Exp $ * $Header: /cvsroot/pgsql/src/backend/utils/cache/typcache.c,v 1.3 2003/11/12 21:15:56 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -158,22 +158,26 @@ lookup_type_cache(Oid type_id, int flags) ...@@ -158,22 +158,26 @@ lookup_type_cache(Oid type_id, int flags)
{ {
if (typentry->btree_opc != InvalidOid) if (typentry->btree_opc != InvalidOid)
typentry->eq_opr = get_opclass_member(typentry->btree_opc, typentry->eq_opr = get_opclass_member(typentry->btree_opc,
InvalidOid,
BTEqualStrategyNumber); BTEqualStrategyNumber);
if (typentry->eq_opr == InvalidOid && if (typentry->eq_opr == InvalidOid &&
typentry->hash_opc != InvalidOid) typentry->hash_opc != InvalidOid)
typentry->eq_opr = get_opclass_member(typentry->hash_opc, typentry->eq_opr = get_opclass_member(typentry->hash_opc,
InvalidOid,
HTEqualStrategyNumber); HTEqualStrategyNumber);
} }
if ((flags & TYPECACHE_LT_OPR) && typentry->lt_opr == InvalidOid) if ((flags & TYPECACHE_LT_OPR) && typentry->lt_opr == InvalidOid)
{ {
if (typentry->btree_opc != InvalidOid) if (typentry->btree_opc != InvalidOid)
typentry->lt_opr = get_opclass_member(typentry->btree_opc, typentry->lt_opr = get_opclass_member(typentry->btree_opc,
InvalidOid,
BTLessStrategyNumber); BTLessStrategyNumber);
} }
if ((flags & TYPECACHE_GT_OPR) && typentry->gt_opr == InvalidOid) if ((flags & TYPECACHE_GT_OPR) && typentry->gt_opr == InvalidOid)
{ {
if (typentry->btree_opc != InvalidOid) if (typentry->btree_opc != InvalidOid)
typentry->gt_opr = get_opclass_member(typentry->btree_opc, typentry->gt_opr = get_opclass_member(typentry->btree_opc,
InvalidOid,
BTGreaterStrategyNumber); BTGreaterStrategyNumber);
} }
if ((flags & (TYPECACHE_CMP_PROC | TYPECACHE_CMP_PROC_FINFO)) && if ((flags & (TYPECACHE_CMP_PROC | TYPECACHE_CMP_PROC_FINFO)) &&
...@@ -181,6 +185,7 @@ lookup_type_cache(Oid type_id, int flags) ...@@ -181,6 +185,7 @@ lookup_type_cache(Oid type_id, int flags)
{ {
if (typentry->btree_opc != InvalidOid) if (typentry->btree_opc != InvalidOid)
typentry->cmp_proc = get_opclass_proc(typentry->btree_opc, typentry->cmp_proc = get_opclass_proc(typentry->btree_opc,
InvalidOid,
BTORDER_PROC); BTORDER_PROC);
} }
...@@ -248,10 +253,10 @@ lookup_default_opclass(Oid type_id, Oid am_id) ...@@ -248,10 +253,10 @@ lookup_default_opclass(Oid type_id, Oid am_id)
*/ */
rel = heap_openr(OperatorClassRelationName, AccessShareLock); rel = heap_openr(OperatorClassRelationName, AccessShareLock);
ScanKeyEntryInitialize(&skey[0], 0, ScanKeyInit(&skey[0],
Anum_pg_opclass_opcamid, Anum_pg_opclass_opcamid,
BTEqualStrategyNumber, F_OIDEQ, BTEqualStrategyNumber, F_OIDEQ,
ObjectIdGetDatum(am_id), OIDOID); ObjectIdGetDatum(am_id));
scan = systable_beginscan(rel, OpclassAmNameNspIndex, true, scan = systable_beginscan(rel, OpclassAmNameNspIndex, true,
SnapshotNow, 1, skey); SnapshotNow, 1, skey);
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/init/postinit.c,v 1.128 2003/11/09 21:30:37 tgl Exp $ * $Header: /cvsroot/pgsql/src/backend/utils/init/postinit.c,v 1.129 2003/11/12 21:15:56 tgl Exp $
* *
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
...@@ -26,7 +26,6 @@ ...@@ -26,7 +26,6 @@
#include "catalog/namespace.h" #include "catalog/namespace.h"
#include "catalog/pg_database.h" #include "catalog/pg_database.h"
#include "catalog/pg_shadow.h" #include "catalog/pg_shadow.h"
#include "catalog/pg_type.h"
#include "commands/trigger.h" #include "commands/trigger.h"
#include "mb/pg_wchar.h" #include "mb/pg_wchar.h"
#include "miscadmin.h" #include "miscadmin.h"
...@@ -92,10 +91,10 @@ ReverifyMyDatabase(const char *name) ...@@ -92,10 +91,10 @@ ReverifyMyDatabase(const char *name)
*/ */
pgdbrel = heap_openr(DatabaseRelationName, AccessShareLock); pgdbrel = heap_openr(DatabaseRelationName, AccessShareLock);
ScanKeyEntryInitialize(&key, 0, ScanKeyInit(&key,
Anum_pg_database_datname, Anum_pg_database_datname,
BTEqualStrategyNumber, F_NAMEEQ, BTEqualStrategyNumber, F_NAMEEQ,
NameGetDatum(name), NAMEOID); NameGetDatum(name));
pgdbscan = heap_beginscan(pgdbrel, SnapshotNow, 1, &key); pgdbscan = heap_beginscan(pgdbrel, SnapshotNow, 1, &key);
......
...@@ -78,7 +78,7 @@ ...@@ -78,7 +78,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/utils/sort/tuplesort.c,v 1.38 2003/11/09 21:30:37 tgl Exp $ * $Header: /cvsroot/pgsql/src/backend/utils/sort/tuplesort.c,v 1.39 2003/11/12 21:15:56 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -472,15 +472,14 @@ tuplesort_begin_heap(TupleDesc tupDesc, ...@@ -472,15 +472,14 @@ tuplesort_begin_heap(TupleDesc tupDesc,
&state->sortFnKinds[i]); &state->sortFnKinds[i]);
/* /*
* We needn't fill in sk_strategy or sk_argtype since these scankeys * We needn't fill in sk_strategy or sk_subtype since these scankeys
* will never be passed to an index. * will never be passed to an index.
*/ */
ScanKeyEntryInitialize(&state->scanKeys[i], 0, ScanKeyInit(&state->scanKeys[i],
attNums[i], attNums[i],
InvalidStrategy, InvalidStrategy,
sortFunction, sortFunction,
(Datum) 0, (Datum) 0);
InvalidOid);
} }
return state; return state;
...@@ -1739,6 +1738,10 @@ SelectSortFunction(Oid sortOperator, ...@@ -1739,6 +1738,10 @@ SelectSortFunction(Oid sortOperator,
if (!opclass_is_btree(aform->amopclaid)) if (!opclass_is_btree(aform->amopclaid))
continue; continue;
/* must be of default subtype, too */
if (aform->amopsubtype != InvalidOid)
continue;
if (aform->amopstrategy == BTLessStrategyNumber) if (aform->amopstrategy == BTLessStrategyNumber)
{ {
opclass = aform->amopclaid; opclass = aform->amopclaid;
...@@ -1757,8 +1760,8 @@ SelectSortFunction(Oid sortOperator, ...@@ -1757,8 +1760,8 @@ SelectSortFunction(Oid sortOperator,
if (OidIsValid(opclass)) if (OidIsValid(opclass))
{ {
/* Found a suitable opclass, get its comparator support function */ /* Found a suitable opclass, get its default comparator function */
*sortFunction = get_opclass_proc(opclass, BTORDER_PROC); *sortFunction = get_opclass_proc(opclass, InvalidOid, BTORDER_PROC);
Assert(RegProcedureIsValid(*sortFunction)); Assert(RegProcedureIsValid(*sortFunction));
return; return;
} }
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group * Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California * Portions Copyright (c) 1994, Regents of the University of California
* *
* $Id: nbtree.h,v 1.72 2003/11/09 21:30:37 tgl Exp $ * $Id: nbtree.h,v 1.73 2003/11/12 21:15:57 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -341,7 +341,7 @@ typedef struct xl_btree_newpage ...@@ -341,7 +341,7 @@ typedef struct xl_btree_newpage
/* /*
* Operator strategy numbers for B-tree have been moved to access/skey.h, * Operator strategy numbers for B-tree have been moved to access/skey.h,
* because many places need to use them in ScanKeyEntryInitialize() calls. * because many places need to use them in ScanKeyInit() calls.
*/ */
/* /*
...@@ -404,12 +404,12 @@ typedef struct BTScanOpaqueData ...@@ -404,12 +404,12 @@ typedef struct BTScanOpaqueData
Buffer btso_mrkbuf; Buffer btso_mrkbuf;
ItemPointerData curHeapIptr; ItemPointerData curHeapIptr;
ItemPointerData mrkHeapIptr; ItemPointerData mrkHeapIptr;
/* these fields are set by _bt_orderkeys(), which see for more info: */ /* these fields are set by _bt_preprocess_keys(): */
bool qual_ok; /* false if qual can never be satisfied */ bool qual_ok; /* false if qual can never be satisfied */
int numberOfKeys; /* number of scan keys */ int numberOfKeys; /* number of preprocessed scan keys */
int numberOfRequiredKeys; /* number of keys that must be int numberOfRequiredKeys; /* number of keys that must be
* matched to continue the scan */ * matched to continue the scan */
ScanKey keyData; /* array of scan keys */ ScanKey keyData; /* array of preprocessed scan keys */
} BTScanOpaqueData; } BTScanOpaqueData;
typedef BTScanOpaqueData *BTScanOpaque; typedef BTScanOpaqueData *BTScanOpaque;
...@@ -424,7 +424,6 @@ extern Datum btinsert(PG_FUNCTION_ARGS); ...@@ -424,7 +424,6 @@ extern Datum btinsert(PG_FUNCTION_ARGS);
extern Datum btgettuple(PG_FUNCTION_ARGS); extern Datum btgettuple(PG_FUNCTION_ARGS);
extern Datum btbeginscan(PG_FUNCTION_ARGS); extern Datum btbeginscan(PG_FUNCTION_ARGS);
extern Datum btrescan(PG_FUNCTION_ARGS); extern Datum btrescan(PG_FUNCTION_ARGS);
extern void btmovescan(IndexScanDesc scan, Datum v);
extern Datum btendscan(PG_FUNCTION_ARGS); extern Datum btendscan(PG_FUNCTION_ARGS);
extern Datum btmarkpos(PG_FUNCTION_ARGS); extern Datum btmarkpos(PG_FUNCTION_ARGS);
extern Datum btrestrpos(PG_FUNCTION_ARGS); extern Datum btrestrpos(PG_FUNCTION_ARGS);
...@@ -480,7 +479,7 @@ extern ScanKey _bt_mkscankey(Relation rel, IndexTuple itup); ...@@ -480,7 +479,7 @@ extern ScanKey _bt_mkscankey(Relation rel, IndexTuple itup);
extern ScanKey _bt_mkscankey_nodata(Relation rel); extern ScanKey _bt_mkscankey_nodata(Relation rel);
extern void _bt_freeskey(ScanKey skey); extern void _bt_freeskey(ScanKey skey);
extern void _bt_freestack(BTStack stack); extern void _bt_freestack(BTStack stack);
extern void _bt_orderkeys(IndexScanDesc scan); extern void _bt_preprocess_keys(IndexScanDesc scan);
extern bool _bt_checkkeys(IndexScanDesc scan, IndexTuple tuple, extern bool _bt_checkkeys(IndexScanDesc scan, IndexTuple tuple,
ScanDirection dir, bool *continuescan); ScanDirection dir, bool *continuescan);
extern BTItem _bt_formitem(IndexTuple itup); extern BTItem _bt_formitem(IndexTuple itup);
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group * Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California * Portions Copyright (c) 1994, Regents of the University of California
* *
* $Id: skey.h,v 1.23 2003/11/09 21:30:37 tgl Exp $ * $Id: skey.h,v 1.24 2003/11/12 21:15:57 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -20,7 +20,8 @@ ...@@ -20,7 +20,8 @@
/* /*
* Strategy numbers identify the semantics that particular operators have * Strategy numbers identify the semantics that particular operators have
* with respect to particular operator classes. * with respect to particular operator classes. In some cases a strategy
* subtype (an OID) is used as further information.
*/ */
typedef uint16 StrategyNumber; typedef uint16 StrategyNumber;
...@@ -47,23 +48,23 @@ typedef uint16 StrategyNumber; ...@@ -47,23 +48,23 @@ typedef uint16 StrategyNumber;
* (The data structure can support unary indexable operators too; in that * (The data structure can support unary indexable operators too; in that
* case sk_argument would go unused. This is not currently implemented.) * case sk_argument would go unused. This is not currently implemented.)
* *
* For an index scan, sk_strategy must be set correctly for the operator. * For an index scan, sk_strategy and sk_subtype must be set correctly for
* When using a ScanKey in a heap scan, sk_strategy is not used and may be * the operator. When using a ScanKey in a heap scan, these fields are not
* set to InvalidStrategy. * used and may be set to InvalidStrategy/InvalidOid.
* *
* Note: in some places, ScanKeys are used as a convenient representation * Note: in some places, ScanKeys are used as a convenient representation
* for the invocation of an access method support procedure. In this case * for the invocation of an access method support procedure. In this case
* sk_strategy is not meaningful, and sk_func may refer to a function that * sk_strategy/sk_subtype are not meaningful, and sk_func may refer to a
* returns something other than boolean. * function that returns something other than boolean.
*/ */
typedef struct ScanKeyData typedef struct ScanKeyData
{ {
int sk_flags; /* flags, see below */ int sk_flags; /* flags, see below */
AttrNumber sk_attno; /* table or index column number */ AttrNumber sk_attno; /* table or index column number */
StrategyNumber sk_strategy; /* operator strategy number */ StrategyNumber sk_strategy; /* operator strategy number */
Oid sk_subtype; /* strategy subtype */
FmgrInfo sk_func; /* lookup info for function to call */ FmgrInfo sk_func; /* lookup info for function to call */
Datum sk_argument; /* data to compare */ Datum sk_argument; /* data to compare */
Oid sk_argtype; /* datatype of sk_argument */
} ScanKeyData; } ScanKeyData;
typedef ScanKeyData *ScanKey; typedef ScanKeyData *ScanKey;
...@@ -76,19 +77,24 @@ typedef ScanKeyData *ScanKey; ...@@ -76,19 +77,24 @@ typedef ScanKeyData *ScanKey;
/* /*
* prototypes for functions in access/common/scankey.c * prototypes for functions in access/common/scankey.c
*/ */
extern void ScanKeyInit(ScanKey entry,
AttrNumber attributeNumber,
StrategyNumber strategy,
RegProcedure procedure,
Datum argument);
extern void ScanKeyEntryInitialize(ScanKey entry, extern void ScanKeyEntryInitialize(ScanKey entry,
int flags, int flags,
AttrNumber attributeNumber, AttrNumber attributeNumber,
StrategyNumber strategy, StrategyNumber strategy,
Oid subtype,
RegProcedure procedure, RegProcedure procedure,
Datum argument, Datum argument);
Oid argtype);
extern void ScanKeyEntryInitializeWithInfo(ScanKey entry, extern void ScanKeyEntryInitializeWithInfo(ScanKey entry,
int flags, int flags,
AttrNumber attributeNumber, AttrNumber attributeNumber,
StrategyNumber strategy, StrategyNumber strategy,
Oid subtype,
FmgrInfo *finfo, FmgrInfo *finfo,
Datum argument, Datum argument);
Oid argtype);
#endif /* SKEY_H */ #endif /* SKEY_H */
...@@ -37,7 +37,7 @@ ...@@ -37,7 +37,7 @@
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group * Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California * Portions Copyright (c) 1994, Regents of the University of California
* *
* $Id: catversion.h,v 1.210 2003/10/21 16:23:16 tgl Exp $ * $Id: catversion.h,v 1.211 2003/11/12 21:15:57 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -53,6 +53,6 @@ ...@@ -53,6 +53,6 @@
*/ */
/* yyyymmddN */ /* yyyymmddN */
#define CATALOG_VERSION_NO 200310211 #define CATALOG_VERSION_NO 200311101
#endif #endif
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group * Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California * Portions Copyright (c) 1994, Regents of the University of California
* *
* $Id: indexing.h,v 1.79 2003/08/04 02:40:10 momjian Exp $ * $Id: indexing.h,v 1.80 2003/11/12 21:15:57 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -24,8 +24,8 @@ ...@@ -24,8 +24,8 @@
* macros rather than hardwiring the actual index name. * macros rather than hardwiring the actual index name.
*/ */
#define AccessMethodOperatorIndex "pg_amop_opr_opc_index" #define AccessMethodOperatorIndex "pg_amop_opr_opc_index"
#define AccessMethodStrategyIndex "pg_amop_opc_strategy_index" #define AccessMethodStrategyIndex "pg_amop_opc_strat_index"
#define AccessMethodProcedureIndex "pg_amproc_opc_procnum_index" #define AccessMethodProcedureIndex "pg_amproc_opc_proc_index"
#define AggregateFnoidIndex "pg_aggregate_fnoid_index" #define AggregateFnoidIndex "pg_aggregate_fnoid_index"
#define AmNameIndex "pg_am_name_index" #define AmNameIndex "pg_am_name_index"
#define AmOidIndex "pg_am_oid_index" #define AmOidIndex "pg_am_oid_index"
...@@ -115,9 +115,9 @@ extern void CatalogUpdateIndexes(Relation heapRel, HeapTuple heapTuple); ...@@ -115,9 +115,9 @@ extern void CatalogUpdateIndexes(Relation heapRel, HeapTuple heapTuple);
DECLARE_UNIQUE_INDEX(pg_aggregate_fnoid_index on pg_aggregate using btree(aggfnoid oid_ops)); DECLARE_UNIQUE_INDEX(pg_aggregate_fnoid_index on pg_aggregate using btree(aggfnoid oid_ops));
DECLARE_UNIQUE_INDEX(pg_am_name_index on pg_am using btree(amname name_ops)); DECLARE_UNIQUE_INDEX(pg_am_name_index on pg_am using btree(amname name_ops));
DECLARE_UNIQUE_INDEX(pg_am_oid_index on pg_am using btree(oid oid_ops)); DECLARE_UNIQUE_INDEX(pg_am_oid_index on pg_am using btree(oid oid_ops));
DECLARE_UNIQUE_INDEX(pg_amop_opc_strat_index on pg_amop using btree(amopclaid oid_ops, amopsubtype oid_ops, amopstrategy int2_ops));
DECLARE_UNIQUE_INDEX(pg_amop_opr_opc_index on pg_amop using btree(amopopr oid_ops, amopclaid oid_ops)); DECLARE_UNIQUE_INDEX(pg_amop_opr_opc_index on pg_amop using btree(amopopr oid_ops, amopclaid oid_ops));
DECLARE_UNIQUE_INDEX(pg_amop_opc_strategy_index on pg_amop using btree(amopclaid oid_ops, amopstrategy int2_ops)); DECLARE_UNIQUE_INDEX(pg_amproc_opc_proc_index on pg_amproc using btree(amopclaid oid_ops, amprocsubtype oid_ops, amprocnum int2_ops));
DECLARE_UNIQUE_INDEX(pg_amproc_opc_procnum_index on pg_amproc using btree(amopclaid oid_ops, amprocnum int2_ops));
DECLARE_UNIQUE_INDEX(pg_attrdef_adrelid_adnum_index on pg_attrdef using btree(adrelid oid_ops, adnum int2_ops)); DECLARE_UNIQUE_INDEX(pg_attrdef_adrelid_adnum_index on pg_attrdef using btree(adrelid oid_ops, adnum int2_ops));
DECLARE_UNIQUE_INDEX(pg_attrdef_oid_index on pg_attrdef using btree(oid oid_ops)); DECLARE_UNIQUE_INDEX(pg_attrdef_oid_index on pg_attrdef using btree(oid oid_ops));
DECLARE_UNIQUE_INDEX(pg_attribute_relid_attnam_index on pg_attribute using btree(attrelid oid_ops, attname name_ops)); DECLARE_UNIQUE_INDEX(pg_attribute_relid_attnam_index on pg_attribute using btree(attrelid oid_ops, attname name_ops));
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group * Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California * Portions Copyright (c) 1994, Regents of the University of California
* *
* $Id: namespace.h,v 1.27 2003/08/04 02:40:10 momjian Exp $ * $Id: namespace.h,v 1.28 2003/11/12 21:15:57 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -42,9 +42,9 @@ typedef struct _OpclassCandidateList ...@@ -42,9 +42,9 @@ typedef struct _OpclassCandidateList
char *opcname_tmp; /* for internal use of namespace lookup */ char *opcname_tmp; /* for internal use of namespace lookup */
int pathpos; /* for internal use of namespace lookup */ int pathpos; /* for internal use of namespace lookup */
Oid oid; /* the opclass's OID */ Oid oid; /* the opclass's OID */
Oid opcintype; /* type of input data for opclass */ Oid opcintype; /* type of data indexed by opclass */
bool opcdefault; /* T if opclass is default for opcintype */ bool opcdefault; /* T if opclass is default for opcintype */
Oid opckeytype; /* type of index data, or InvalidOid */ Oid opckeytype; /* type of data in index, or InvalidOid */
} *OpclassCandidateList; } *OpclassCandidateList;
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group * Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California * Portions Copyright (c) 1994, Regents of the University of California
* *
* $Id: plannodes.h,v 1.69 2003/11/09 21:30:37 tgl Exp $ * $Id: plannodes.h,v 1.70 2003/11/12 21:15:59 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -165,6 +165,7 @@ typedef struct IndexScan ...@@ -165,6 +165,7 @@ typedef struct IndexScan
List *indxqual; /* list of sublists of index quals */ List *indxqual; /* list of sublists of index quals */
List *indxqualorig; /* the same in original form */ List *indxqualorig; /* the same in original form */
List *indxstrategy; /* list of sublists of strategy numbers */ List *indxstrategy; /* list of sublists of strategy numbers */
List *indxsubtype; /* list of sublists of strategy subtypes */
ScanDirection indxorderdir; /* forward or backward or don't care */ ScanDirection indxorderdir; /* forward or backward or don't care */
} IndexScan; } IndexScan;
......
This diff is collapsed.
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group * Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California * Portions Copyright (c) 1994, Regents of the University of California
* *
* $Id: geo_decls.h,v 1.41 2003/08/04 02:40:15 momjian Exp $ * $Id: geo_decls.h,v 1.42 2003/11/12 21:15:59 tgl Exp $
* *
* NOTE * NOTE
* These routines do *not* use the float types from adt/. * These routines do *not* use the float types from adt/.
...@@ -399,7 +399,6 @@ extern Datum circle_area(PG_FUNCTION_ARGS); ...@@ -399,7 +399,6 @@ extern Datum circle_area(PG_FUNCTION_ARGS);
extern Datum rt_box_union(PG_FUNCTION_ARGS); extern Datum rt_box_union(PG_FUNCTION_ARGS);
extern Datum rt_box_inter(PG_FUNCTION_ARGS); extern Datum rt_box_inter(PG_FUNCTION_ARGS);
extern Datum rt_box_size(PG_FUNCTION_ARGS); extern Datum rt_box_size(PG_FUNCTION_ARGS);
extern Datum rt_bigbox_size(PG_FUNCTION_ARGS);
extern Datum rt_poly_size(PG_FUNCTION_ARGS); extern Datum rt_poly_size(PG_FUNCTION_ARGS);
extern Datum rt_poly_union(PG_FUNCTION_ARGS); extern Datum rt_poly_union(PG_FUNCTION_ARGS);
extern Datum rt_poly_inter(PG_FUNCTION_ARGS); extern Datum rt_poly_inter(PG_FUNCTION_ARGS);
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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