PostgreSQL Source Code
git master
Toggle main menu visibility
Main Page
Related Pages
Namespaces
Namespace List
Namespace Members
All
a
c
d
g
h
i
k
l
m
p
r
s
t
Functions
Variables
Data Structures
Data Structures
Data Structure Index
Class Hierarchy
Data Fields
All
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Functions
_
a
c
d
f
h
i
n
o
p
r
s
t
~
Variables
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Enumerations
Files
File List
Globals
All
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Functions
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Variables
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Typedefs
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Enumerations
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
Enumerator
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
z
Macros
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
•
All
Data Structures
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Macros
Pages
skipsupport.c
Go to the documentation of this file.
1
/*-------------------------------------------------------------------------
2
*
3
* skipsupport.c
4
* Support routines for B-Tree skip scan.
5
*
6
*
7
* Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group
8
* Portions Copyright (c) 1994, Regents of the University of California
9
*
10
* IDENTIFICATION
11
* src/backend/utils/adt/skipsupport.c
12
*
13
*-------------------------------------------------------------------------
14
*/
15
16
#include "
postgres.h
"
17
18
#include "
access/nbtree.h
"
19
#include "
utils/lsyscache.h
"
20
#include "
utils/skipsupport.h
"
21
22
/*
23
* Fill in SkipSupport given an operator class (opfamily + opcintype).
24
*
25
* On success, returns skip support struct, allocating in caller's memory
26
* context. Otherwise returns NULL, indicating that operator class has no
27
* skip support function.
28
*/
29
SkipSupport
30
PrepareSkipSupportFromOpclass
(
Oid
opfamily,
Oid
opcintype,
bool
reverse)
31
{
32
Oid
skipSupportFunction;
33
SkipSupport
sksup;
34
35
/* Look for a skip support function */
36
skipSupportFunction =
get_opfamily_proc
(opfamily, opcintype, opcintype,
37
BTSKIPSUPPORT_PROC
);
38
if
(!
OidIsValid
(skipSupportFunction))
39
return
NULL;
40
41
sksup =
palloc
(
sizeof
(
SkipSupportData
));
42
OidFunctionCall1
(skipSupportFunction,
PointerGetDatum
(sksup));
43
44
if
(reverse)
45
{
46
/*
47
* DESC/reverse case: swap low_elem with high_elem, and swap decrement
48
* with increment
49
*/
50
Datum
low_elem = sksup->
low_elem
;
51
SkipSupportIncDec
decrement = sksup->
decrement
;
52
53
sksup->
low_elem
= sksup->
high_elem
;
54
sksup->
decrement
= sksup->
increment
;
55
56
sksup->
high_elem
= low_elem;
57
sksup->
increment
= decrement;
58
}
59
60
return
sksup;
61
}
OidIsValid
#define OidIsValid(objectId)
Definition:
c.h:746
OidFunctionCall1
#define OidFunctionCall1(functionId, arg1)
Definition:
fmgr.h:720
get_opfamily_proc
Oid get_opfamily_proc(Oid opfamily, Oid lefttype, Oid righttype, int16 procnum)
Definition:
lsyscache.c:888
lsyscache.h
palloc
void * palloc(Size size)
Definition:
mcxt.c:1940
nbtree.h
BTSKIPSUPPORT_PROC
#define BTSKIPSUPPORT_PROC
Definition:
nbtree.h:722
postgres.h
PointerGetDatum
static Datum PointerGetDatum(const void *X)
Definition:
postgres.h:327
Datum
uintptr_t Datum
Definition:
postgres.h:69
Oid
unsigned int Oid
Definition:
postgres_ext.h:30
PrepareSkipSupportFromOpclass
SkipSupport PrepareSkipSupportFromOpclass(Oid opfamily, Oid opcintype, bool reverse)
Definition:
skipsupport.c:30
skipsupport.h
SkipSupportIncDec
Datum(* SkipSupportIncDec)(Relation rel, Datum existing, bool *overflow)
Definition:
skipsupport.h:51
SkipSupportData
Definition:
skipsupport.h:62
SkipSupportData::low_elem
Datum low_elem
Definition:
skipsupport.h:67
SkipSupportData::high_elem
Datum high_elem
Definition:
skipsupport.h:68
SkipSupportData::decrement
SkipSupportIncDec decrement
Definition:
skipsupport.h:91
SkipSupportData::increment
SkipSupportIncDec increment
Definition:
skipsupport.h:92
src
backend
utils
adt
skipsupport.c
Generated on Sun Apr 13 2025 06:13:23 for PostgreSQL Source Code by
1.9.4