Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Postgres FD Implementation
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Abuhujair Javed
Postgres FD Implementation
Commits
d663d439
Commit
d663d439
authored
Mar 17, 2014
by
Heikki Linnakangas
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix thinko: have trueTriConsistentFn return GIN_TRUE.
While we're at it, also improve comments in ginlogic.c.
parent
2bccced1
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
14 deletions
+21
-14
src/backend/access/gin/ginlogic.c
src/backend/access/gin/ginlogic.c
+21
-14
No files found.
src/backend/access/gin/ginlogic.c
View file @
d663d439
...
...
@@ -3,18 +3,25 @@
* ginlogic.c
* routines for performing binary- and ternary-logic consistent checks.
*
* A GIN operator class provides a consistent function which checks if a
* tuple matches a qual, when the given set of keys are present in the tuple.
* The consistent function is passed a TRUE/FALSE argument for every key,
* indicating if that key is present, and it returns TRUE or FALSE. However,
* a GIN scan can apply various optimizations, if it can determine that an
* item matches or doesn't match, even if it doesn't know if some of the keys
* are present or not. Hence, it's useful to have a ternary-logic consistent
* function, where each key can be TRUE (present), FALSE (not present),
* or MAYBE (don't know if present). This file provides such a ternary-logic
* consistent function, implemented by calling the regular boolean consistent
* function many times, with all the MAYBE arguments set to all combinations
* of TRUE and FALSE.
* A GIN operator class can provide a boolean or ternary consistent
* function, or both. This file provides both boolean and ternary
* interfaces to the rest of the GIN code, even if only one of them is
* implemented by the opclass.
*
* Providing a boolean interface when the opclass implements only the
* ternary function is straightforward - just call the ternary function
* with the check-array as is, and map the GIN_TRUE, GIN_FALSE, GIN_MAYBE
* return codes to TRUE, FALSE and TRUE+recheck, respectively. Providing
* a ternary interface when the opclass only implements a boolean function
* is implemented by calling the boolean function many times, with all the
* MAYBE arguments set to all combinations of TRUE and FALSE (up to a
* certain number of MAYBE arguments).
*
* (A boolean function is enough to determine if an item matches, but a
* GIN scan can apply various optimizations if it can determine that an
* item matches or doesn't match, even if it doesn't know if some of the
* keys are present or not. That's what the ternary consistent function
* is used for.)
*
*
* Portions Copyright (c) 1996-2014, PostgreSQL Global Development Group
...
...
@@ -43,7 +50,7 @@
#define MAX_MAYBE_ENTRIES 4
/*
*
A dummy consistent function for an EVERYTHING key.
Just claim it matches.
*
Dummy consistent functions for an EVERYTHING key.
Just claim it matches.
*/
static
bool
trueConsistentFn
(
GinScanKey
key
)
...
...
@@ -54,7 +61,7 @@ trueConsistentFn(GinScanKey key)
static
GinLogicValue
trueTriConsistentFn
(
GinScanKey
key
)
{
return
GIN_
MAYB
E
;
return
GIN_
TRU
E
;
}
/*
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment