1
/*-------------------------------------------------------------------------
4
* scan key support code
6
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
7
* Portions Copyright (c) 1994, Regents of the University of California
11
* $PostgreSQL: pgsql/src/backend/access/common/scankey.c,v 1.27 2004-12-31 21:59:07 pgsql Exp $
13
*-------------------------------------------------------------------------
17
#include "access/skey.h"
21
* ScanKeyEntryInitialize
22
* Initializes a scan key entry given all the field values.
23
* The target procedure is specified by OID.
25
* Note: CurrentMemoryContext at call should be as long-lived as the ScanKey
26
* itself, because that's what will be used for any subsidiary info attached
27
* to the ScanKey's FmgrInfo record.
30
ScanKeyEntryInitialize(ScanKey entry,
32
AttrNumber attributeNumber,
33
StrategyNumber strategy,
35
RegProcedure procedure,
38
entry->sk_flags = flags;
39
entry->sk_attno = attributeNumber;
40
entry->sk_strategy = strategy;
41
entry->sk_subtype = subtype;
42
entry->sk_argument = argument;
43
fmgr_info(procedure, &entry->sk_func);
48
* Shorthand version of ScanKeyEntryInitialize: flags and subtype
49
* are assumed to be zero (the usual value).
51
* This is the recommended version for hardwired lookups in system catalogs.
52
* It cannot handle NULL arguments, unary operators, or nondefault operators,
53
* but we need none of those features for most hardwired lookups.
55
* Note: CurrentMemoryContext at call should be as long-lived as the ScanKey
56
* itself, because that's what will be used for any subsidiary info attached
57
* to the ScanKey's FmgrInfo record.
60
ScanKeyInit(ScanKey entry,
61
AttrNumber attributeNumber,
62
StrategyNumber strategy,
63
RegProcedure procedure,
67
entry->sk_attno = attributeNumber;
68
entry->sk_strategy = strategy;
69
entry->sk_subtype = InvalidOid;
70
entry->sk_argument = argument;
71
fmgr_info(procedure, &entry->sk_func);
75
* ScanKeyEntryInitializeWithInfo
76
* Initializes a scan key entry using an already-completed FmgrInfo
77
* function lookup record.
79
* Note: CurrentMemoryContext at call should be as long-lived as the ScanKey
80
* itself, because that's what will be used for any subsidiary info attached
81
* to the ScanKey's FmgrInfo record.
84
ScanKeyEntryInitializeWithInfo(ScanKey entry,
86
AttrNumber attributeNumber,
87
StrategyNumber strategy,
92
entry->sk_flags = flags;
93
entry->sk_attno = attributeNumber;
94
entry->sk_strategy = strategy;
95
entry->sk_subtype = subtype;
96
entry->sk_argument = argument;
97
fmgr_info_copy(&entry->sk_func, finfo, CurrentMemoryContext);