Team Ai
Datasetpublic

codekingpro/portable-devtools

sourceHugging Faceupdated 5mo agoView on Hugging Face
1likes16kdownloads
queryenvironment.h75 linesDownload Raw Back to utils
1/*-------------------------------------------------------------------------2 *3 * queryenvironment.h4 *	  Access to functions to mutate the query environment and retrieve the5 *	  actual data related to entries (if any).6 *7 * Portions Copyright (c) 1996-2023, PostgreSQL Global Development Group8 * Portions Copyright (c) 1994, Regents of the University of California9 *10 * src/include/utils/queryenvironment.h11 *12 *-------------------------------------------------------------------------13 */14#ifndef QUERYENVIRONMENT_H15#define QUERYENVIRONMENT_H16 17#include "access/tupdesc.h"18 19 20typedef enum EphemeralNameRelationType21{22	ENR_NAMED_TUPLESTORE		/* named tuplestore relation; e.g., deltas */23} EphemeralNameRelationType;24 25/*26 * Some ephemeral named relations must match some relation (e.g., trigger27 * transition tables), so to properly handle cached plans and DDL, we should28 * carry the OID of that relation.  In other cases an ENR might be independent29 * of any relation which is stored in the system catalogs, so we need to be30 * able to directly store the TupleDesc.  We never need both.31 */32typedef struct EphemeralNamedRelationMetadataData33{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 */42} EphemeralNamedRelationMetadataData;43 44typedef EphemeralNamedRelationMetadataData *EphemeralNamedRelationMetadata;45 46/*47 * Ephemeral Named Relation data; used for parsing named relations not in the48 * catalog, like transition tables in AFTER triggers.49 */50typedef struct EphemeralNamedRelationData51{52	EphemeralNamedRelationMetadataData md;53	void	   *reldata;		/* structure for execution-time access to data */54} EphemeralNamedRelationData;55 56typedef EphemeralNamedRelationData *EphemeralNamedRelation;57 58/*59 * This is an opaque structure outside of queryenvironment.c itself.  The60 * intention is to be able to change the implementation or add new context61 * features without needing to change existing code for use of existing62 * features.63 */64typedef struct QueryEnvironment QueryEnvironment;65 66 67extern QueryEnvironment *create_queryEnv(void);68extern EphemeralNamedRelationMetadata get_visible_ENR_metadata(QueryEnvironment *queryEnv, const char *refname);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);72extern TupleDesc ENRMetadataGetTupDesc(EphemeralNamedRelationMetadata enrmd);73 74#endif							/* QUERYENVIRONMENT_H */75 
codekingpro/portable-devtools · Team Ai