Age Owner Branch data TLA Line data Source code
1 : : /*
2 : : * contrib/btree_gist/btree_gist.c
3 : : */
4 : : #include "postgres.h"
5 : :
6 : : #include "access/cmptype.h"
7 : : #include "access/stratnum.h"
8 : : #include "utils/builtins.h"
9 : :
164 tgl@sss.pgh.pa.us 10 :CBC 33 : PG_MODULE_MAGIC_EXT(
11 : : .name = "btree_gist",
12 : : .version = PG_VERSION
13 : : );
14 : :
7771 teodor@sigaev.ru 15 : 27 : PG_FUNCTION_INFO_V1(gbt_decompress);
7678 bruce@momjian.us 16 : 18 : PG_FUNCTION_INFO_V1(gbtreekey_in);
7771 teodor@sigaev.ru 17 : 18 : PG_FUNCTION_INFO_V1(gbtreekey_out);
96 peter@eisentraut.org 18 : 5 : PG_FUNCTION_INFO_V1(gist_translate_cmptype_btree);
19 : :
20 : : /**************************************************
21 : : * In/Out for keys
22 : : **************************************************/
23 : :
24 : :
25 : : Datum
7771 teodor@sigaev.ru 26 :UBC 0 : gbtreekey_in(PG_FUNCTION_ARGS)
27 : : {
1001 tgl@sss.pgh.pa.us 28 : 0 : Oid typioparam = PG_GETARG_OID(1);
29 : :
7678 bruce@momjian.us 30 [ # # ]: 0 : ereport(ERROR,
31 : : (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
32 : : errmsg("cannot accept a value of type %s",
33 : : format_type_extended(typioparam, -1,
34 : : FORMAT_TYPE_ALLOW_INVALID))));
35 : :
36 : : PG_RETURN_VOID(); /* keep compiler quiet */
37 : : }
38 : :
39 : : Datum
7771 teodor@sigaev.ru 40 : 0 : gbtreekey_out(PG_FUNCTION_ARGS)
41 : : {
42 : : /* Sadly, we do not receive any indication of the specific type */
7678 bruce@momjian.us 43 [ # # ]: 0 : ereport(ERROR,
44 : : (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
45 : : errmsg("cannot display a value of type %s", "gbtreekey?")));
46 : :
47 : : PG_RETURN_VOID(); /* keep compiler quiet */
48 : : }
49 : :
50 : :
51 : : /*
52 : : ** GiST DeCompress methods
53 : : ** do not do anything.
54 : : */
55 : : Datum
7771 teodor@sigaev.ru 56 :CBC 101517 : gbt_decompress(PG_FUNCTION_ARGS)
57 : : {
7678 bruce@momjian.us 58 : 101517 : PG_RETURN_POINTER(PG_GETARG_POINTER(0));
59 : : }
60 : :
61 : : /*
62 : : * Returns the btree number for supported operators, otherwise invalid.
63 : : */
64 : : Datum
96 peter@eisentraut.org 65 : 5 : gist_translate_cmptype_btree(PG_FUNCTION_ARGS)
66 : : {
234 67 : 5 : CompareType cmptype = PG_GETARG_INT32(0);
68 : :
69 [ + - - - : 5 : switch (cmptype)
- + ]
70 : : {
71 : 4 : case COMPARE_EQ:
354 72 : 4 : PG_RETURN_UINT16(BTEqualStrategyNumber);
234 peter@eisentraut.org 73 :UBC 0 : case COMPARE_LT:
354 74 : 0 : PG_RETURN_UINT16(BTLessStrategyNumber);
234 75 : 0 : case COMPARE_LE:
354 76 : 0 : PG_RETURN_UINT16(BTLessEqualStrategyNumber);
234 77 : 0 : case COMPARE_GT:
354 78 : 0 : PG_RETURN_UINT16(BTGreaterStrategyNumber);
234 79 : 0 : case COMPARE_GE:
354 80 : 0 : PG_RETURN_UINT16(BTGreaterEqualStrategyNumber);
354 peter@eisentraut.org 81 :CBC 1 : default:
82 : 1 : PG_RETURN_UINT16(InvalidStrategy);
83 : : }
84 : : }
|