LCOV - code coverage report
Current view: top level - contrib/btree_gist - btree_gist.c (source / functions) Hit Total Coverage
Test: PostgreSQL 18devel Lines: 14 27 51.9 %
Date: 2025-01-18 04:15:08 Functions: 7 9 77.8 %
Legend: Lines: hit not hit

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

Generated by: LCOV version 1.14