PostgreSQL Source Code git master
Loading...
Searching...
No Matches
attribute_stats.c
Go to the documentation of this file.
1/*-------------------------------------------------------------------------
2 * attribute_stats.c
3 *
4 * PostgreSQL relation attribute statistics manipulation.
5 *
6 * Code supporting the direct import of relation attribute statistics, similar
7 * to what is done by the ANALYZE command.
8 *
9 * Portions Copyright (c) 1996-2026, PostgreSQL Global Development Group
10 * Portions Copyright (c) 1994, Regents of the University of California
11 *
12 * IDENTIFICATION
13 * src/backend/statistics/attribute_stats.c
14 *
15 *-------------------------------------------------------------------------
16 */
17
18#include "postgres.h"
19
20#include "access/heapam.h"
21#include "catalog/indexing.h"
22#include "catalog/namespace.h"
23#include "catalog/pg_operator.h"
24#include "nodes/makefuncs.h"
27#include "utils/array.h"
28#include "utils/builtins.h"
29#include "utils/fmgroids.h"
30#include "utils/lsyscache.h"
31#include "utils/syscache.h"
32
33/*
34 * Positional argument numbers, names, and types for
35 * attribute_statistics_update() and pg_restore_attribute_stats().
36 */
37
60
61static struct StatsArgInfo attarginfo[] =
62{
63 [ATTRELSCHEMA_ARG] = {"schemaname", TEXTOID},
64 [ATTRELNAME_ARG] = {"relname", TEXTOID},
65 [ATTNAME_ARG] = {"attname", TEXTOID},
66 [ATTNUM_ARG] = {"attnum", INT2OID},
67 [INHERITED_ARG] = {"inherited", BOOLOID},
68 [NULL_FRAC_ARG] = {"null_frac", FLOAT4OID},
69 [AVG_WIDTH_ARG] = {"avg_width", INT4OID},
70 [N_DISTINCT_ARG] = {"n_distinct", FLOAT4OID},
71 [MOST_COMMON_VALS_ARG] = {"most_common_vals", TEXTOID},
72 [MOST_COMMON_FREQS_ARG] = {"most_common_freqs", FLOAT4ARRAYOID},
73 [HISTOGRAM_BOUNDS_ARG] = {"histogram_bounds", TEXTOID},
74 [CORRELATION_ARG] = {"correlation", FLOAT4OID},
75 [MOST_COMMON_ELEMS_ARG] = {"most_common_elems", TEXTOID},
76 [MOST_COMMON_ELEM_FREQS_ARG] = {"most_common_elem_freqs", FLOAT4ARRAYOID},
77 [ELEM_COUNT_HISTOGRAM_ARG] = {"elem_count_histogram", FLOAT4ARRAYOID},
78 [RANGE_LENGTH_HISTOGRAM_ARG] = {"range_length_histogram", TEXTOID},
79 [RANGE_EMPTY_FRAC_ARG] = {"range_empty_frac", FLOAT4OID},
80 [RANGE_BOUNDS_HISTOGRAM_ARG] = {"range_bounds_histogram", TEXTOID},
82};
83
84/*
85 * Positional argument numbers, names, and types for
86 * pg_clear_attribute_stats().
87 */
88
97
98static struct StatsArgInfo cleararginfo[] =
99{
100 [C_ATTRELSCHEMA_ARG] = {"schemaname", TEXTOID},
101 [C_ATTRELNAME_ARG] = {"relname", TEXTOID},
102 [C_ATTNAME_ARG] = {"attname", TEXTOID},
103 [C_INHERITED_ARG] = {"inherited", BOOLOID},
105};
106
109 const char *attname,
111 bool inherited,
112 FunctionCallInfo fcinfo);
114 const Datum *values, const bool *nulls, const bool *replaces);
115static bool delete_pg_statistic(Oid reloid, AttrNumber attnum, bool stainherit);
116
117/*
118 * Insert or Update Attribute Statistics
119 *
120 * See pg_statistic.h for an explanation of how each statistic kind is
121 * stored. Custom statistics kinds are not supported.
122 *
123 * Depending on the statistics kind, we need to derive information from the
124 * attribute for which we're storing the stats. For instance, the MCVs are
125 * stored as an anyarray, and the representation of the array needs to store
126 * the correct element type, which must be derived from the attribute.
127 *
128 * Major errors, such as the table not existing, the attribute not existing,
129 * or a permissions failure are always reported at ERROR. Other errors, such
130 * as a conversion failure on one statistic kind, are reported as a WARNING
131 * and other statistic kinds may still be updated.
132 */
133static bool
135{
136 char *nspname;
137 char *relname;
138 Oid reloid;
139 char *attname;
141 bool inherited;
143
146
149
150 if (RecoveryInProgress())
153 errmsg("recovery is in progress"),
154 errhint("Statistics cannot be modified during recovery.")));
155
156 /* lock before looking up attribute */
157 reloid = RangeVarGetRelidExtended(makeRangeVar(nspname, relname, -1),
160
161 /* user can specify either attname or attnum, but not both */
163 {
167 errmsg("cannot specify both \"%s\" and \"%s\"", "attname", "attnum")));
169 attnum = get_attnum(reloid, attname);
170 /* note that this test covers attisdropped cases too: */
174 errmsg("column \"%s\" of relation \"%s\" does not exist",
175 attname, relname)));
176 }
177 else if (!PG_ARGISNULL(ATTNUM_ARG))
178 {
180 attname = get_attname(reloid, attnum, true);
181 /* annoyingly, get_attname doesn't check attisdropped */
182 if (attname == NULL ||
186 errmsg("column %d of relation \"%s\" does not exist",
187 attnum, relname)));
188 }
189 else
190 {
193 errmsg("must specify either \"%s\" or \"%s\"", "attname", "attnum")));
194 attname = NULL; /* keep compiler quiet */
195 attnum = 0;
196 }
197
198 if (attnum < 0)
201 errmsg("cannot modify statistics on system column \"%s\"",
202 attname)));
203
206
208 inherited, fcinfo);
209}
210
211/*
212 * Workhorse function for attribute_statistics_update.
213 */
214static bool
216 const char *attname, AttrNumber attnum,
217 bool inherited, FunctionCallInfo fcinfo)
218{
221
222 Oid atttypid = InvalidOid;
223 int32 atttypmod;
224 char atttyptype;
226 Oid eq_opr = InvalidOid;
227 Oid lt_opr = InvalidOid;
228
231
233
244
246 bool nulls[Natts_pg_statistic] = {0};
247 bool replaces[Natts_pg_statistic] = {0};
248
249 bool result = true;
250
251 /*
252 * Check argument sanity. If some arguments are unusable, emit a WARNING
253 * and set the corresponding argument to NULL in fcinfo.
254 */
255
257 {
258 do_mcv = false;
259 result = false;
260 }
261
263 {
264 do_mcelem = false;
265 result = false;
266 }
268 {
269 do_dechist = false;
270 result = false;
271 }
272
273 if (!stats_check_arg_pair(fcinfo, attarginfo,
275 {
276 do_mcv = false;
277 result = false;
278 }
279
280 if (!stats_check_arg_pair(fcinfo, attarginfo,
283 {
284 do_mcelem = false;
285 result = false;
286 }
287
288 if (!stats_check_arg_pair(fcinfo, attarginfo,
291 {
293 result = false;
294 }
295
296 /* derive information from attribute */
297 statatt_get_type(reloid, attnum,
298 &atttypid, &atttypmod,
300 &eq_opr, &lt_opr);
301
302 /* if needed, derive element type */
303 if (do_mcelem || do_dechist)
304 {
305 if (!statatt_get_elem_type(atttypid, atttyptype,
307 {
309 (errmsg("could not determine element type of column \"%s\"", attname),
310 errdetail("Cannot set %s or %s.",
311 "STATISTIC_KIND_MCELEM", "STATISTIC_KIND_DECHIST")));
314
315 do_mcelem = false;
316 do_dechist = false;
317 result = false;
318 }
319 }
320
321 /* histogram and correlation require less-than operator */
322 if ((do_histogram || do_correlation) && !OidIsValid(lt_opr))
323 {
326 errmsg("could not determine less-than operator for column \"%s\"", attname),
327 errdetail("Cannot set %s or %s.",
328 "STATISTIC_KIND_HISTOGRAM", "STATISTIC_KIND_CORRELATION")));
329
330 do_histogram = false;
331 do_correlation = false;
332 result = false;
333 }
334
335 /* only range types can have range stats */
338 {
341 errmsg("column \"%s\" is not a range type", attname),
342 errdetail("Cannot set %s or %s.",
343 "STATISTIC_KIND_RANGE_LENGTH_HISTOGRAM", "STATISTIC_KIND_BOUNDS_HISTOGRAM")));
344
345 do_bounds_histogram = false;
347 result = false;
348 }
349
351
353
355
356 /* initialize from existing tuple if exists */
359 else
361 replaces);
362
363 /* if specified, set to argument values */
365 {
368 }
370 {
373 }
375 {
378 }
379
380 /* STATISTIC_KIND_MCV */
381 if (do_mcv)
382 {
383 bool converted;
385 Datum stavalues = statatt_build_stavalues("most_common_vals",
388 atttypid, atttypmod,
389 &converted);
390
391 if (converted)
392 {
395 int nvals = ARR_DIMS(vals_arr)[0];
396 int nnums = ARR_DIMS(nums_arr)[0];
397
398 if (nvals != nnums)
399 {
402 errmsg("could not parse \"%s\": incorrect number of elements (same as \"%s\" required)",
403 "most_common_vals",
404 "most_common_freqs")));
405 result = false;
406 }
407 else
408 {
411 eq_opr, atttypcoll,
412 stanumbers, false, stavalues, false);
413 }
414 }
415 else
416 result = false;
417 }
418
419 /* STATISTIC_KIND_HISTOGRAM */
420 if (do_histogram)
421 {
422 Datum stavalues;
423 bool converted = false;
424
425 stavalues = statatt_build_stavalues("histogram_bounds",
428 atttypid, atttypmod,
429 &converted);
430
431 if (converted)
432 {
435 lt_opr, atttypcoll,
436 0, true, stavalues, false);
437 }
438 else
439 result = false;
440 }
441
442 /* STATISTIC_KIND_CORRELATION */
443 if (do_correlation)
444 {
447 Datum stanumbers = PointerGetDatum(arry);
448
451 lt_opr, atttypcoll,
452 stanumbers, false, 0, true);
453 }
454
455 /* STATISTIC_KIND_MCELEM */
456 if (do_mcelem)
457 {
459 bool converted = false;
460 Datum stavalues;
461
462 stavalues = statatt_build_stavalues("most_common_elems",
465 elemtypid, atttypmod,
466 &converted);
467
468 if (converted)
469 {
473 stanumbers, false, stavalues, false);
474 }
475 else
476 result = false;
477 }
478
479 /* STATISTIC_KIND_DECHIST */
480 if (do_dechist)
481 {
483
487 stanumbers, false, 0, true);
488 }
489
490 /*
491 * STATISTIC_KIND_BOUNDS_HISTOGRAM
492 *
493 * This stakind appears before STATISTIC_KIND_RANGE_LENGTH_HISTOGRAM even
494 * though it is numerically greater, and all other stakinds appear in
495 * numerical order. We duplicate this quirk for consistency.
496 */
498 {
499 bool converted = false;
500 Datum stavalues;
501
502 stavalues = statatt_build_stavalues("range_bounds_histogram",
505 atttypid, atttypmod,
506 &converted);
507
508 if (converted &&
510 {
514 0, true, stavalues, false);
515 }
516 else
517 result = false;
518 }
519
520 /* STATISTIC_KIND_RANGE_LENGTH_HISTOGRAM */
522 {
523 /* The anyarray is always a float8[] for this stakind */
526 Datum stanumbers = PointerGetDatum(arry);
527
528 bool converted = false;
529 Datum stavalues;
530
531 stavalues = statatt_build_stavalues("range_length_histogram",
534 FLOAT8OID, 0, &converted);
535
536 if (converted)
537 {
541 stanumbers, false, stavalues, false);
542 }
543 else
544 result = false;
545 }
546
548
552
553 return result;
554}
555
556/*
557 * Upsert the pg_statistic record.
558 */
559static void
561 const Datum *values, const bool *nulls, const bool *replaces)
562{
564
566 {
568 values, nulls, replaces);
570 }
571 else
572 {
575 }
576
578
580}
581
582/*
583 * Delete pg_statistic record.
584 */
585static bool
587{
590 bool result = false;
591
592 /* Is there already a pg_statistic tuple for this attribute? */
594 ObjectIdGetDatum(reloid),
597
599 {
600 CatalogTupleDelete(sd, &oldtup->t_self);
602 result = true;
603 }
604
606
608
609 return result;
610}
611
612/*
613 * Delete statistics for the given attribute.
614 */
615Datum
617{
618 char *nspname;
619 char *relname;
620 Oid reloid;
621 char *attname;
623 bool inherited;
625
630
633
634 if (RecoveryInProgress())
637 errmsg("recovery is in progress"),
638 errhint("Statistics cannot be modified during recovery.")));
639
640 reloid = RangeVarGetRelidExtended(makeRangeVar(nspname, relname, -1),
643
645 attnum = get_attnum(reloid, attname);
646
647 if (attnum < 0)
650 errmsg("cannot clear statistics on system column \"%s\"",
651 attname)));
652
656 errmsg("column \"%s\" of relation \"%s\" does not exist",
657 attname, get_rel_name(reloid))));
658
660
663}
664
665/*
666 * Import statistics for a given relation attribute.
667 *
668 * Inserts or replaces a row in pg_statistic for the given relation and
669 * attribute name or number. It takes input parameters that correspond to
670 * columns in the view pg_stats.
671 *
672 * Parameters are given in a pseudo named-attribute style: they must be
673 * pairs of parameter names (as text) and values (of appropriate types).
674 * We do that, rather than using regular named-parameter notation, so
675 * that we can add or change parameters without fear of breaking
676 * carelessly-written calls.
677 *
678 * Parameters null_frac, avg_width, and n_distinct all correspond to NOT NULL
679 * columns in pg_statistic. The remaining parameters all belong to a specific
680 * stakind. Some stakinds require multiple parameters, which must be specified
681 * together (or neither specified).
682 *
683 * Parameters are only superficially validated. Omitting a parameter or
684 * passing NULL leaves the statistic unchanged.
685 *
686 * Parameters corresponding to ANYARRAY columns are instead passed in as text
687 * values, which is a valid input string for an array of the type or element
688 * type of the attribute. Any error generated by the array_in() function will
689 * in turn fail the function.
690 */
691Datum
709
710/*
711 * Import attribute statistics from NullableDatum inputs for all statistical
712 * values.
713 *
714 * For now, the 'version' argument is ignored. In the future it can be used
715 * to interpret older statistics properly.
716 */
717bool
719 const NullableDatum *version,
722 const NullableDatum *n_distinct,
733{
735 Oid reloid = RelationGetRelid(rel);
736 char *relname = RelationGetRelationName(rel);
737 char *attname = get_attname(reloid, attnum, true);
738
741 Assert(n_distinct);
752
753 /* annoyingly, get_attname doesn't check attisdropped */
754 if (attname == NULL ||
758 errmsg("column %d of relation \"%s\" does not exist",
759 attnum, relname)));
760
763
764 newfcinfo->args[ATTRELSCHEMA_ARG].value =
766 newfcinfo->args[ATTRELSCHEMA_ARG].isnull = false;
768 newfcinfo->args[ATTRELNAME_ARG].isnull = false;
770 newfcinfo->args[ATTNAME_ARG].isnull = false;
772 newfcinfo->args[ATTNUM_ARG].isnull = false;
774 newfcinfo->args[INHERITED_ARG].isnull = false;
775
778 newfcinfo->args[N_DISTINCT_ARG] = *n_distinct;
789
792}
793
794/*
795 * Delete attribute statistics.
796 */
797bool
#define DatumGetArrayTypeP(X)
Definition array.h:261
#define ARR_DIMS(a)
Definition array.h:294
ArrayType * construct_array_builtin(Datum *elems, int nelems, Oid elmtype)
int16 AttrNumber
Definition attnum.h:21
#define InvalidAttrNumber
Definition attnum.h:23
static bool delete_pg_statistic(Oid reloid, AttrNumber attnum, bool stainherit)
attribute_stats_argnum
@ ATTNUM_ARG
@ RANGE_LENGTH_HISTOGRAM_ARG
@ RANGE_BOUNDS_HISTOGRAM_ARG
@ ATTRELSCHEMA_ARG
@ AVG_WIDTH_ARG
@ INHERITED_ARG
@ ATTRELNAME_ARG
@ MOST_COMMON_ELEMS_ARG
@ NULL_FRAC_ARG
@ NUM_ATTRIBUTE_STATS_ARGS
@ MOST_COMMON_FREQS_ARG
@ CORRELATION_ARG
@ HISTOGRAM_BOUNDS_ARG
@ MOST_COMMON_VALS_ARG
@ RANGE_EMPTY_FRAC_ARG
@ ELEM_COUNT_HISTOGRAM_ARG
@ ATTNAME_ARG
@ N_DISTINCT_ARG
@ MOST_COMMON_ELEM_FREQS_ARG
static struct StatsArgInfo cleararginfo[]
static void upsert_pg_statistic(Relation starel, HeapTuple oldtup, const Datum *values, const bool *nulls, const bool *replaces)
static struct StatsArgInfo attarginfo[]
static bool attribute_statistics_update(FunctionCallInfo fcinfo)
clear_attribute_stats_argnum
@ C_INHERITED_ARG
@ C_NUM_ATTRIBUTE_STATS_ARGS
@ C_ATTNAME_ARG
@ C_ATTRELNAME_ARG
@ C_ATTRELSCHEMA_ARG
Datum pg_clear_attribute_stats(PG_FUNCTION_ARGS)
bool delete_attribute_statistics(Relation rel, AttrNumber attnum, bool inherited)
bool import_attribute_statistics(Relation rel, AttrNumber attnum, bool inherited, const NullableDatum *version, const NullableDatum *null_frac, const NullableDatum *avg_width, const NullableDatum *n_distinct, const NullableDatum *most_common_vals, const NullableDatum *most_common_freqs, const NullableDatum *histogram_bounds, const NullableDatum *correlation, const NullableDatum *most_common_elems, const NullableDatum *most_common_elem_freqs, const NullableDatum *elem_count_histogram, const NullableDatum *range_length_histogram, const NullableDatum *range_empty_frac, const NullableDatum *range_bounds_histogram)
static bool attribute_statistics_update_internal(Oid reloid, const char *attname, AttrNumber attnum, bool inherited, FunctionCallInfo fcinfo)
Datum pg_restore_attribute_stats(PG_FUNCTION_ARGS)
static Datum values[MAXATTR]
Definition bootstrap.c:190
#define CStringGetTextDatum(s)
Definition builtins.h:98
#define TextDatumGetCString(d)
Definition builtins.h:99
#define Assert(condition)
Definition c.h:1002
int32_t int32
Definition c.h:679
#define OidIsValid(objectId)
Definition c.h:917
uint32 result
int errcode(int sqlerrcode)
Definition elog.c:875
int errhint(const char *fmt,...) pg_attribute_printf(1
int errdetail(const char *fmt,...) pg_attribute_printf(1
#define WARNING
Definition elog.h:37
#define ERROR
Definition elog.h:40
#define ereport(elevel,...)
Definition elog.h:152
void fmgr_info(Oid functionId, FmgrInfo *finfo)
Definition fmgr.c:129
#define PG_RETURN_VOID()
Definition fmgr.h:350
#define InitFunctionCallInfoData(Fcinfo, Flinfo, Nargs, Collation, Context, Resultinfo)
Definition fmgr.h:150
#define PG_ARGISNULL(n)
Definition fmgr.h:209
#define PG_GETARG_DATUM(n)
Definition fmgr.h:268
#define LOCAL_FCINFO(name, nargs)
Definition fmgr.h:110
#define PG_GETARG_BOOL(n)
Definition fmgr.h:274
#define PG_FUNCTION_ARGS
Definition fmgr.h:193
#define PG_RETURN_BOOL(x)
Definition fmgr.h:360
#define PG_GETARG_INT16(n)
Definition fmgr.h:271
HeapTuple heap_modify_tuple(HeapTuple tuple, TupleDesc tupleDesc, const Datum *replValues, const bool *replIsnull, const bool *doReplace)
Definition heaptuple.c:1118
HeapTuple heap_form_tuple(TupleDesc tupleDescriptor, const Datum *values, const bool *isnull)
Definition heaptuple.c:1025
void heap_deform_tuple(HeapTuple tuple, TupleDesc tupleDesc, Datum *values, bool *isnull)
Definition heaptuple.c:1254
void heap_freetuple(HeapTuple htup)
Definition heaptuple.c:1372
#define HeapTupleIsValid(tuple)
Definition htup.h:78
void CatalogTupleUpdate(Relation heapRel, const ItemPointerData *otid, HeapTuple tup)
Definition indexing.c:313
void CatalogTupleInsert(Relation heapRel, HeapTuple tup)
Definition indexing.c:233
void CatalogTupleDelete(Relation heapRel, const ItemPointerData *tid)
Definition indexing.c:365
#define ShareUpdateExclusiveLock
Definition lockdefs.h:39
#define RowExclusiveLock
Definition lockdefs.h:38
char * get_rel_name(Oid relid)
Definition lsyscache.c:2242
AttrNumber get_attnum(Oid relid, const char *attname)
Definition lsyscache.c:1084
char * get_attname(Oid relid, AttrNumber attnum, bool missing_ok)
Definition lsyscache.c:1053
char * get_namespace_name(Oid nspid)
Definition lsyscache.c:3682
RangeVar * makeRangeVar(char *schemaname, char *relname, int location)
Definition makefuncs.c:473
Oid RangeVarGetRelidExtended(const RangeVar *relation, LOCKMODE lockmode, uint32 flags, RangeVarGetRelidCallback callback, void *callback_arg)
Definition namespace.c:442
static char * errmsg
NameData attname
int16 attnum
NameData relname
Definition pg_class.h:40
static Datum Int16GetDatum(int16 X)
Definition postgres.h:172
static Datum BoolGetDatum(bool X)
Definition postgres.h:112
static Datum ObjectIdGetDatum(Oid X)
Definition postgres.h:252
uint64_t Datum
Definition postgres.h:70
#define PointerGetDatum(X)
Definition postgres.h:354
#define InvalidOid
unsigned int Oid
static int fb(int x)
#define RelationGetRelid(relation)
Definition rel.h:516
#define RelationGetDescr(relation)
Definition rel.h:542
#define RelationGetRelationName(relation)
Definition rel.h:550
#define RelationGetNamespace(relation)
Definition rel.h:557
bool statatt_get_elem_type(Oid atttypid, char atttyptype, Oid *elemtypid, Oid *elem_eq_opr)
Definition stat_utils.c:524
Datum statatt_build_stavalues(const char *staname, FmgrInfo *array_in, Datum d, Oid typid, int32 typmod, bool *ok)
Definition stat_utils.c:568
bool stats_fill_fcinfo_from_arg_pairs(FunctionCallInfo pairs_fcinfo, FunctionCallInfo positional_fcinfo, struct StatsArgInfo *arginfo)
Definition stat_utils.c:349
void RangeVarCallbackForStats(const RangeVar *relation, Oid relId, Oid oldRelId, void *arg)
Definition stat_utils.c:143
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:71
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:438
void stats_check_required_arg(FunctionCallInfo fcinfo, struct StatsArgInfo *arginfo, int argnum)
Definition stat_utils.c:52
bool statatt_check_bounds_histogram(Datum arrayval)
Definition stat_utils.c:753
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:112
void ReleaseSysCache(HeapTuple tuple)
Definition syscache.c:265
bool SearchSysCacheExistsAttName(Oid relid, const char *attname)
Definition syscache.c:518
HeapTuple SearchSysCache3(SysCacheIdentifier cacheId, Datum key1, Datum key2, Datum key3)
Definition syscache.c:241
void table_close(Relation relation, LOCKMODE lockmode)
Definition table.c:126
Relation table_open(Oid relationId, LOCKMODE lockmode)
Definition table.c:40
void CommandCounterIncrement(void)
Definition xact.c:1130
bool RecoveryInProgress(void)
Definition xlog.c:6835