PostgreSQL Source Code git master
stat_utils.h
Go to the documentation of this file.
1/*-------------------------------------------------------------------------
2 *
3 * stat_utils.h
4 * Extended statistics and selectivity estimation functions.
5 *
6 * Portions Copyright (c) 1996-2026, PostgreSQL Global Development Group
7 * Portions Copyright (c) 1994, Regents of the University of California
8 *
9 * src/include/statistics/stat_utils.h
10 *
11 *-------------------------------------------------------------------------
12 */
13#ifndef STATS_UTILS_H
14#define STATS_UTILS_H
15
16#include "access/attnum.h"
17#include "fmgr.h"
18
19/* avoid including primnodes.h here */
20typedef struct RangeVar RangeVar;
21
23{
24 const char *argname;
26};
27
29 struct StatsArgInfo *arginfo,
30 int argnum);
32 struct StatsArgInfo *arginfo, int argnum);
33extern bool stats_check_arg_pair(FunctionCallInfo fcinfo,
34 struct StatsArgInfo *arginfo,
35 int argnum1, int argnum2);
36
37extern void RangeVarCallbackForStats(const RangeVar *relation,
38 Oid relId, Oid oldRelId, void *arg);
39
41 FunctionCallInfo positional_fcinfo,
42 struct StatsArgInfo *arginfo);
43
44extern void statatt_get_type(Oid reloid, AttrNumber attnum,
45 Oid *atttypid, int32 *atttypmod,
46 char *atttyptype, Oid *atttypcoll,
47 Oid *eq_opr, Oid *lt_opr);
48extern void statatt_init_empty_tuple(Oid reloid, int16 attnum, bool inherited,
49 Datum *values, bool *nulls, bool *replaces);
50
51extern void statatt_set_slot(Datum *values, bool *nulls, bool *replaces,
52 int16 stakind, Oid staop, Oid stacoll,
53 Datum stanumbers, bool stanumbers_isnull,
54 Datum stavalues, bool stavalues_isnull);
55
56extern Datum statatt_build_stavalues(const char *staname, FmgrInfo *array_in, Datum d,
57 Oid typid, int32 typmod, bool *ok);
58extern bool statatt_get_elem_type(Oid atttypid, char atttyptype,
59 Oid *elemtypid, Oid *elem_eq_opr);
60
61#endif /* STATS_UTILS_H */
Datum array_in(PG_FUNCTION_ARGS)
Definition: arrayfuncs.c:180
int16 AttrNumber
Definition: attnum.h:21
static Datum values[MAXATTR]
Definition: bootstrap.c:155
int16_t int16
Definition: c.h:547
int32_t int32
Definition: c.h:548
int16 attnum
Definition: pg_attribute.h:74
void * arg
uint64_t Datum
Definition: postgres.h:70
unsigned int Oid
Definition: postgres_ext.h:32
bool statatt_get_elem_type(Oid atttypid, char atttyptype, Oid *elemtypid, Oid *elem_eq_opr)
Definition: stat_utils.c:522
Datum statatt_build_stavalues(const char *staname, FmgrInfo *array_in, Datum d, Oid typid, int32 typmod, bool *ok)
Definition: stat_utils.c:566
bool stats_fill_fcinfo_from_arg_pairs(FunctionCallInfo pairs_fcinfo, FunctionCallInfo positional_fcinfo, struct StatsArgInfo *arginfo)
Definition: stat_utils.c:347
void RangeVarCallbackForStats(const RangeVar *relation, Oid relId, Oid oldRelId, void *arg)
Definition: stat_utils.c:141
void statatt_init_empty_tuple(Oid reloid, int16 attnum, bool inherited, Datum *values, bool *nulls, bool *replaces)
Definition: stat_utils.c:712
bool stats_check_arg_array(FunctionCallInfo fcinfo, struct StatsArgInfo *arginfo, int argnum)
Definition: stat_utils.c:69
void statatt_get_type(Oid reloid, AttrNumber attnum, Oid *atttypid, int32 *atttypmod, char *atttyptype, Oid *atttypcoll, Oid *eq_opr, Oid *lt_opr)
Definition: stat_utils.c:436
void stats_check_required_arg(FunctionCallInfo fcinfo, struct StatsArgInfo *arginfo, int argnum)
Definition: stat_utils.c:50
void statatt_set_slot(Datum *values, bool *nulls, bool *replaces, int16 stakind, Oid staop, Oid stacoll, Datum stanumbers, bool stanumbers_isnull, Datum stavalues, bool stavalues_isnull)
Definition: stat_utils.c:634
bool stats_check_arg_pair(FunctionCallInfo fcinfo, struct StatsArgInfo *arginfo, int argnum1, int argnum2)
Definition: stat_utils.c:110
Definition: fmgr.h:57
const char * argname
Definition: stat_utils.h:24