Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitf7ea931

Browse files
committed
Some minor code cleanup, falling out from the removal of rtree. SK_NEGATE
isn't being used anywhere anymore, and there seems no point in a genericindex_keytest() routine when two out of three remaining access methodsaren't using it. Also, add a comment documenting a convention forletting access methods define private flag bits in ScanKey sk_flags.There are no such flags at the moment but I'm thinking about changingbtree's handling of "required keys" to use flag bits in the keysrather than a count of required key positions. Also, if some AM didstill want SK_NEGATE then it would be reasonable to treat it as a privateflag bit.
1 parent7930e62 commitf7ea931

File tree

7 files changed

+57
-131
lines changed

7 files changed

+57
-131
lines changed

‎src/backend/access/common/Makefile

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,15 @@
44
# Makefile for access/common
55
#
66
# IDENTIFICATION
7-
# $PostgreSQL: pgsql/src/backend/access/common/Makefile,v 1.20 2003/11/29 19:51:39 pgsql Exp $
7+
# $PostgreSQL: pgsql/src/backend/access/common/Makefile,v 1.21 2006/01/14 22:03:35 tgl Exp $
88
#
99
#-------------------------------------------------------------------------
1010

1111
subdir = src/backend/access/common
1212
top_builddir = ../../../..
1313
include$(top_builddir)/src/Makefile.global
1414

15-
OBJS = heaptuple.o indextuple.o indexvalid.o printtup.o\
16-
scankey.o tupdesc.o
15+
OBJS = heaptuple.o indextuple.o printtup.o scankey.o tupdesc.o
1716

1817
all: SUBSYS.o
1918

‎src/backend/access/common/indexvalid.c

Lines changed: 0 additions & 78 deletions
This file was deleted.

‎src/backend/access/gist/gistget.c

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
* Portions Copyright (c) 1994, Regents of the University of California
99
*
1010
* IDENTIFICATION
11-
* $PostgreSQL: pgsql/src/backend/access/gist/gistget.c,v 1.54 2005/11/22 18:17:05 momjian Exp $
11+
* $PostgreSQL: pgsql/src/backend/access/gist/gistget.c,v 1.55 2006/01/14 22:03:35 tgl Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -332,13 +332,15 @@ gistnext(IndexScanDesc scan, ScanDirection dir, ItemPointer tids, int maxtids, b
332332
}
333333

334334
/*
335-
* Similar to index_keytest, but first decompress the key in the
336-
* IndexTuple before passing it to the sk_func (and we have previously
337-
* overwritten the sk_func to use the user-defined Consistent method,
338-
* so we actually invoke that). Note that this function is always
339-
* invoked in a short-lived memory context, so we don't need to worry
340-
* about cleaning up allocated memory (either here or in the
341-
* implementation of any Consistent methods).
335+
* gistindex_keytest() -- does this index tuple satisfy the scan key(s)?
336+
*
337+
* We must decompress the key in the IndexTuple before passing it to the
338+
* sk_func (and we have previously overwritten the sk_func to use the
339+
* user-defined Consistent method, so we actually are invoking that).
340+
*
341+
* Note that this function is always invoked in a short-lived memory context,
342+
* so we don't need to worry about cleaning up allocated memory, either here
343+
* or in the implementation of any Consistent methods.
342344
*/
343345
staticbool
344346
gistindex_keytest(IndexTupletuple,

‎src/backend/access/hash/hashutil.c

Lines changed: 35 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,15 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $PostgreSQL: pgsql/src/backend/access/hash/hashutil.c,v 1.44 2005/11/22 18:17:05 momjian Exp $
11+
* $PostgreSQL: pgsql/src/backend/access/hash/hashutil.c,v 1.45 2006/01/14 22:03:35 tgl Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
1515
#include"postgres.h"
1616

1717
#include"access/genam.h"
1818
#include"access/hash.h"
19-
#include"access/iqual.h"
19+
#include"executor/execdebug.h"
2020

2121

2222
/*
@@ -25,8 +25,39 @@
2525
bool
2626
_hash_checkqual(IndexScanDescscan,IndexTupleitup)
2727
{
28-
returnindex_keytest(itup,RelationGetDescr(scan->indexRelation),
29-
scan->numberOfKeys,scan->keyData);
28+
TupleDesctupdesc=RelationGetDescr(scan->indexRelation);
29+
ScanKeykey=scan->keyData;
30+
intscanKeySize=scan->numberOfKeys;
31+
32+
IncrIndexProcessed();
33+
34+
while (scanKeySize>0)
35+
{
36+
Datumdatum;
37+
boolisNull;
38+
Datumtest;
39+
40+
datum=index_getattr(itup,
41+
key->sk_attno,
42+
tupdesc,
43+
&isNull);
44+
45+
/* assume sk_func is strict */
46+
if (isNull)
47+
return false;
48+
if (key->sk_flags&SK_ISNULL)
49+
return false;
50+
51+
test=FunctionCall2(&key->sk_func,datum,key->sk_argument);
52+
53+
if (!DatumGetBool(test))
54+
return false;
55+
56+
key++;
57+
scanKeySize--;
58+
}
59+
60+
return true;
3061
}
3162

3263
/*

‎src/backend/executor/execUtils.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $PostgreSQL: pgsql/src/backend/executor/execUtils.c,v 1.131 2005/12/03 05:51:01 tgl Exp $
11+
* $PostgreSQL: pgsql/src/backend/executor/execUtils.c,v 1.132 2006/01/14 22:03:35 tgl Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -67,9 +67,7 @@ intNTupleReplaced;
6767
intNTupleAppended;
6868
intNTupleDeleted;
6969
intNIndexTupleInserted;
70-
externintNIndexTupleProcessed;/* have to be defined in the access
71-
* method level so that the
72-
* cinterface.a will link ok. */
70+
intNIndexTupleProcessed;
7371

7472

7573
staticvoidShutdownExprContext(ExprContext*econtext);

‎src/include/access/iqual.h

Lines changed: 0 additions & 31 deletions
This file was deleted.

‎src/include/access/skey.h

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
88
* Portions Copyright (c) 1994, Regents of the University of California
99
*
10-
* $PostgreSQL: pgsql/src/include/access/skey.h,v 1.29 2005/06/24 00:18:52 tgl Exp $
10+
* $PostgreSQL: pgsql/src/include/access/skey.h,v 1.30 2006/01/14 22:03:35 tgl Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -69,10 +69,15 @@ typedef struct ScanKeyData
6969

7070
typedefScanKeyData*ScanKey;
7171

72-
/* ScanKeyData sk_flags */
72+
/*
73+
* ScanKeyData sk_flags
74+
*
75+
* sk_flags bits 0-15 are reserved for system-wide use (symbols for those
76+
* bits should be defined here). Bits 16-31 are reserved for use within
77+
* individual index access methods.
78+
*/
7379
#defineSK_ISNULL0x0001/* sk_argument is NULL */
7480
#defineSK_UNARY0x0002/* unary operator (currently unsupported) */
75-
#defineSK_NEGATE0x0004/* must negate the function result */
7681

7782

7883
/*

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp