LCOV - code coverage report
Current view: top level - contrib/btree_gist - btree_gist.c (source / functions) Hit Total Coverage
Test: PostgreSQL 17devel Lines: 14 27 51.9 %
Date: 2024-04-23 09:11:01 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 "utils/builtins.h"
       8             : 
       9          64 : PG_MODULE_MAGIC;
      10             : 
      11          46 : PG_FUNCTION_INFO_V1(gbt_decompress);
      12          12 : PG_FUNCTION_INFO_V1(gbtreekey_in);
      13          12 : PG_FUNCTION_INFO_V1(gbtreekey_out);
      14           6 : PG_FUNCTION_INFO_V1(gist_stratnum_btree);
      15             : 
      16             : /**************************************************
      17             :  * In/Out for keys
      18             :  **************************************************/
      19             : 
      20             : 
      21             : Datum
      22           0 : gbtreekey_in(PG_FUNCTION_ARGS)
      23             : {
      24           0 :     Oid         typioparam = PG_GETARG_OID(1);
      25             : 
      26           0 :     ereport(ERROR,
      27             :             (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
      28             :              errmsg("cannot accept a value of type %s",
      29             :                     format_type_extended(typioparam, -1,
      30             :                                          FORMAT_TYPE_ALLOW_INVALID))));
      31             : 
      32             :     PG_RETURN_VOID();           /* keep compiler quiet */
      33             : }
      34             : 
      35             : Datum
      36           0 : gbtreekey_out(PG_FUNCTION_ARGS)
      37             : {
      38             :     /* Sadly, we do not receive any indication of the specific type */
      39           0 :     ereport(ERROR,
      40             :             (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
      41             :              errmsg("cannot display a value of type %s", "gbtreekey?")));
      42             : 
      43             :     PG_RETURN_VOID();           /* keep compiler quiet */
      44             : }
      45             : 
      46             : 
      47             : /*
      48             : ** GiST DeCompress methods
      49             : ** do not do anything.
      50             : */
      51             : Datum
      52      223562 : gbt_decompress(PG_FUNCTION_ARGS)
      53             : {
      54      223562 :     PG_RETURN_POINTER(PG_GETARG_POINTER(0));
      55             : }
      56             : 
      57             : /*
      58             :  * Returns the btree number for supported operators, otherwise invalid.
      59             :  */
      60             : Datum
      61          10 : gist_stratnum_btree(PG_FUNCTION_ARGS)
      62             : {
      63          10 :     StrategyNumber strat = PG_GETARG_UINT16(0);
      64             : 
      65          10 :     switch (strat)
      66             :     {
      67           8 :         case RTEqualStrategyNumber:
      68           8 :             PG_RETURN_UINT16(BTEqualStrategyNumber);
      69           0 :         case RTLessStrategyNumber:
      70           0 :             PG_RETURN_UINT16(BTLessStrategyNumber);
      71           0 :         case RTLessEqualStrategyNumber:
      72           0 :             PG_RETURN_UINT16(BTLessEqualStrategyNumber);
      73           0 :         case RTGreaterStrategyNumber:
      74           0 :             PG_RETURN_UINT16(BTGreaterStrategyNumber);
      75           0 :         case RTGreaterEqualStrategyNumber:
      76           0 :             PG_RETURN_UINT16(BTGreaterEqualStrategyNumber);
      77           2 :         default:
      78           2 :             PG_RETURN_UINT16(InvalidStrategy);
      79             :     }
      80             : }

Generated by: LCOV version 1.14