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

Commitd663d43

Browse files
committed
Fix thinko: have trueTriConsistentFn return GIN_TRUE.
While we're at it, also improve comments in ginlogic.c.
1 parent2bccced commitd663d43

File tree

1 file changed

+21
-14
lines changed

1 file changed

+21
-14
lines changed

‎src/backend/access/gin/ginlogic.c

Lines changed: 21 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,25 @@
33
* ginlogic.c
44
* routines for performing binary- and ternary-logic consistent checks.
55
*
6-
* A GIN operator class provides a consistent function which checks if a
7-
* tuple matches a qual, when the given set of keys are present in the tuple.
8-
* The consistent function is passed a TRUE/FALSE argument for every key,
9-
* indicating if that key is present, and it returns TRUE or FALSE. However,
10-
* a GIN scan can apply various optimizations, if it can determine that an
11-
* item matches or doesn't match, even if it doesn't know if some of the keys
12-
* are present or not. Hence, it's useful to have a ternary-logic consistent
13-
* function, where each key can be TRUE (present), FALSE (not present),
14-
* or MAYBE (don't know if present). This file provides such a ternary-logic
15-
* consistent function, implemented by calling the regular boolean consistent
16-
* function many times, with all the MAYBE arguments set to all combinations
17-
* of TRUE and FALSE.
6+
* A GIN operator class can provide a boolean or ternary consistent
7+
* function, or both. This file provides both boolean and ternary
8+
* interfaces to the rest of the GIN code, even if only one of them is
9+
* implemented by the opclass.
10+
*
11+
* Providing a boolean interface when the opclass implements only the
12+
* ternary function is straightforward - just call the ternary function
13+
* with the check-array as is, and map the GIN_TRUE, GIN_FALSE, GIN_MAYBE
14+
* return codes to TRUE, FALSE and TRUE+recheck, respectively. Providing
15+
* a ternary interface when the opclass only implements a boolean function
16+
* is implemented by calling the boolean function many times, with all the
17+
* MAYBE arguments set to all combinations of TRUE and FALSE (up to a
18+
* certain number of MAYBE arguments).
19+
*
20+
* (A boolean function is enough to determine if an item matches, but a
21+
* GIN scan can apply various optimizations if it can determine that an
22+
* item matches or doesn't match, even if it doesn't know if some of the
23+
* keys are present or not. That's what the ternary consistent function
24+
* is used for.)
1825
*
1926
*
2027
* Portions Copyright (c) 1996-2014, PostgreSQL Global Development Group
@@ -43,7 +50,7 @@
4350
#defineMAX_MAYBE_ENTRIES4
4451

4552
/*
46-
*A dummyconsistentfunction for an EVERYTHING key. Just claim it matches.
53+
*Dummyconsistentfunctions for an EVERYTHING key. Just claim it matches.
4754
*/
4855
staticbool
4956
trueConsistentFn(GinScanKeykey)
@@ -54,7 +61,7 @@ trueConsistentFn(GinScanKey key)
5461
staticGinLogicValue
5562
trueTriConsistentFn(GinScanKeykey)
5663
{
57-
returnGIN_MAYBE;
64+
returnGIN_TRUE;
5865
}
5966

6067
/*

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp