LCOV - code coverage report
Current view: top level - src/backend/utils/misc - pg_config.c (source / functions) Hit Total Coverage
Test: PostgreSQL 17devel Lines: 12 12 100.0 %
Date: 2024-04-13 09:11:47 Functions: 1 1 100.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /*-------------------------------------------------------------------------
       2             :  *
       3             :  * pg_config.c
       4             :  *      Expose same output as pg_config except as an SRF
       5             :  *
       6             :  * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group
       7             :  * Portions Copyright (c) 1994, Regents of the University of California
       8             :  *
       9             :  * IDENTIFICATION
      10             :  *    src/backend/utils/misc/pg_config.c
      11             :  *
      12             :  *-------------------------------------------------------------------------
      13             :  */
      14             : 
      15             : #include "postgres.h"
      16             : 
      17             : #include "common/config_info.h"
      18             : #include "funcapi.h"
      19             : #include "miscadmin.h"
      20             : #include "port.h"
      21             : #include "utils/builtins.h"
      22             : 
      23             : Datum
      24           6 : pg_config(PG_FUNCTION_ARGS)
      25             : {
      26           6 :     ReturnSetInfo *rsinfo = (ReturnSetInfo *) fcinfo->resultinfo;
      27             :     ConfigData *configdata;
      28             :     size_t      configdata_len;
      29           6 :     int         i = 0;
      30             : 
      31             :     /* initialize our tuplestore */
      32           6 :     InitMaterializedSRF(fcinfo, 0);
      33             : 
      34           6 :     configdata = get_configdata(my_exec_path, &configdata_len);
      35         144 :     for (i = 0; i < configdata_len; i++)
      36             :     {
      37             :         Datum       values[2];
      38             :         bool        nulls[2];
      39             : 
      40         138 :         memset(values, 0, sizeof(values));
      41         138 :         memset(nulls, 0, sizeof(nulls));
      42             : 
      43         138 :         values[0] = CStringGetTextDatum(configdata[i].name);
      44         138 :         values[1] = CStringGetTextDatum(configdata[i].setting);
      45             : 
      46         138 :         tuplestore_putvalues(rsinfo->setResult, rsinfo->setDesc, values, nulls);
      47             :     }
      48             : 
      49           6 :     return (Datum) 0;
      50             : }

Generated by: LCOV version 1.14