summaryrefslogtreecommitdiff
path: root/src/include/fmgr.h
diff options
context:
space:
mode:
authorPeter Eisentraut2011-02-08 21:04:18 +0000
committerPeter Eisentraut2011-02-08 21:04:18 +0000
commit414c5a2ea65cbd38d79ffdf9b1fde7cc75c134e0 (patch)
tree016efd0c7108f659ea4f3c52ea54d78e1e5449e1 /src/include/fmgr.h
parent1703f0e8da2e8e3eccb6e12879c011ba106f8a62 (diff)
Per-column collation support
This adds collation support for columns and domains, a COLLATE clause to override it per expression, and B-tree index support. Peter Eisentraut reviewed by Pavel Stehule, Itagaki Takahiro, Robert Haas, Noah Misch
Diffstat (limited to 'src/include/fmgr.h')
-rw-r--r--src/include/fmgr.h18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/include/fmgr.h b/src/include/fmgr.h
index 33369b02bc1..9720117a7f5 100644
--- a/src/include/fmgr.h
+++ b/src/include/fmgr.h
@@ -50,6 +50,7 @@ typedef struct FmgrInfo
bool fn_strict; /* function is "strict" (NULL in => NULL out) */
bool fn_retset; /* function returns a set */
unsigned char fn_stats; /* collect stats if track_functions > this */
+ Oid fn_collation; /* collation to use */
void *fn_extra; /* extra space for use by handler */
MemoryContext fn_mcxt; /* memory context to store fn_extra in */
fmNodePtr fn_expr; /* expression parse tree for call, or NULL */
@@ -84,6 +85,16 @@ extern void fmgr_info_cxt(Oid functionId, FmgrInfo *finfo,
MemoryContext mcxt);
/*
+ * Initialize the fn_collation field
+ */
+extern void fmgr_info_collation(Oid collationId, FmgrInfo *finfo);
+
+/*
+ * Initialize the fn_expr field and set the collation based on it
+ */
+extern void fmgr_info_expr(fmNodePtr expr, FmgrInfo *finfo);
+
+/*
* Copy an FmgrInfo struct
*/
extern void fmgr_info_copy(FmgrInfo *dstinfo, FmgrInfo *srcinfo,
@@ -296,6 +307,7 @@ extern struct varlena *pg_detoast_datum_packed(struct varlena * datum);
#define PG_RETURN_VARCHAR_P(x) PG_RETURN_POINTER(x)
#define PG_RETURN_HEAPTUPLEHEADER(x) PG_RETURN_POINTER(x)
+#define PG_GET_COLLATION() (fcinfo->flinfo ? fcinfo->flinfo->fn_collation : InvalidOid)
/*-------------------------------------------------------------------------
* Support for detecting call convention of dynamically-loaded functions
@@ -438,6 +450,12 @@ extern Datum DirectFunctionCall9(PGFunction func, Datum arg1, Datum arg2,
Datum arg6, Datum arg7, Datum arg8,
Datum arg9);
+/* the same but passing a collation */
+extern Datum DirectFunctionCall1WithCollation(PGFunction func, Oid collation,
+ Datum arg1);
+extern Datum DirectFunctionCall2WithCollation(PGFunction func, Oid collation,
+ Datum arg1, Datum arg2);
+
/* These are for invocation of a previously-looked-up function with a
* directly-computed parameter list. Note that neither arguments nor result
* are allowed to be NULL.