PostgreSQL Source Code git master
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
queryenvironment.h
Go to the documentation of this file.
1/*-------------------------------------------------------------------------
2 *
3 * queryenvironment.h
4 * Access to functions to mutate the query environment and retrieve the
5 * actual data related to entries (if any).
6 *
7 * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group
8 * Portions Copyright (c) 1994, Regents of the University of California
9 *
10 * src/include/utils/queryenvironment.h
11 *
12 *-------------------------------------------------------------------------
13 */
14#ifndef QUERYENVIRONMENT_H
15#define QUERYENVIRONMENT_H
16
17#include "access/tupdesc.h"
18
19
21{
22 ENR_NAMED_TUPLESTORE, /* named tuplestore relation; e.g., deltas */
24
25/*
26 * Some ephemeral named relations must match some relation (e.g., trigger
27 * transition tables), so to properly handle cached plans and DDL, we should
28 * carry the OID of that relation. In other cases an ENR might be independent
29 * of any relation which is stored in the system catalogs, so we need to be
30 * able to directly store the TupleDesc. We never need both.
31 */
33{
34 char *name; /* name used to identify the relation */
35
36 /* only one of the next two fields should be used */
37 Oid reliddesc; /* oid of relation to get tupdesc */
38 TupleDesc tupdesc; /* description of result rows */
39
40 EphemeralNameRelationType enrtype; /* to identify type of relation */
41 double enrtuples; /* estimated number of tuples */
43
45
46/*
47 * Ephemeral Named Relation data; used for parsing named relations not in the
48 * catalog, like transition tables in AFTER triggers.
49 */
51{
53 void *reldata; /* structure for execution-time access to data */
55
57
58/*
59 * This is an opaque structure outside of queryenvironment.c itself. The
60 * intention is to be able to change the implementation or add new context
61 * features without needing to change existing code for use of existing
62 * features.
63 */
65
66
69extern void register_ENR(QueryEnvironment *queryEnv, EphemeralNamedRelation enr);
70extern void unregister_ENR(QueryEnvironment *queryEnv, const char *name);
71extern EphemeralNamedRelation get_ENR(QueryEnvironment *queryEnv, const char *name);
73
74#endif /* QUERYENVIRONMENT_H */
unsigned int Oid
Definition: postgres_ext.h:30
TupleDesc ENRMetadataGetTupDesc(EphemeralNamedRelationMetadata enrmd)
struct EphemeralNamedRelationMetadataData EphemeralNamedRelationMetadataData
EphemeralNamedRelation get_ENR(QueryEnvironment *queryEnv, const char *name)
EphemeralNamedRelationData * EphemeralNamedRelation
EphemeralNameRelationType
@ ENR_NAMED_TUPLESTORE
EphemeralNamedRelationMetadata get_visible_ENR_metadata(QueryEnvironment *queryEnv, const char *refname)
void unregister_ENR(QueryEnvironment *queryEnv, const char *name)
QueryEnvironment * create_queryEnv(void)
void register_ENR(QueryEnvironment *queryEnv, EphemeralNamedRelation enr)
struct EphemeralNamedRelationData EphemeralNamedRelationData
EphemeralNamedRelationMetadataData * EphemeralNamedRelationMetadata
EphemeralNamedRelationMetadataData md
EphemeralNameRelationType enrtype
const char * name