mirror of
https://github.com/postgres/postgres.git
synced 2026-03-02 13:24:01 -05:00
Add a queryId field to Query and PlannedStmt. This is not used by the core backend, except for being copied around at appropriate times. It's meant to allow plug-ins to track a particular query forward from parse analysis to execution. The queryId is intentionally not dumped into stored rules (and hence this commit doesn't bump catversion). You could argue that choice either way, but it seems better that stored rule strings not have any dependency on plug-ins that might or might not be present. Also, add a post_parse_analyze_hook that gets invoked at the end of parse analysis (but only for top-level analysis of complete queries, not cases such as analyzing a domain's default-value expression). This is mainly meant to be used to compute and assign a queryId, but it could have other applications. Peter Geoghegan
43 lines
1.4 KiB
C
43 lines
1.4 KiB
C
/*-------------------------------------------------------------------------
|
|
*
|
|
* analyze.h
|
|
* parse analysis for optimizable statements
|
|
*
|
|
*
|
|
* Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group
|
|
* Portions Copyright (c) 1994, Regents of the University of California
|
|
*
|
|
* src/include/parser/analyze.h
|
|
*
|
|
*-------------------------------------------------------------------------
|
|
*/
|
|
#ifndef ANALYZE_H
|
|
#define ANALYZE_H
|
|
|
|
#include "parser/parse_node.h"
|
|
|
|
/* Hook for plugins to get control at end of parse analysis */
|
|
typedef void (*post_parse_analyze_hook_type) (ParseState *pstate,
|
|
Query *query);
|
|
extern PGDLLIMPORT post_parse_analyze_hook_type post_parse_analyze_hook;
|
|
|
|
|
|
extern Query *parse_analyze(Node *parseTree, const char *sourceText,
|
|
Oid *paramTypes, int numParams);
|
|
extern Query *parse_analyze_varparams(Node *parseTree, const char *sourceText,
|
|
Oid **paramTypes, int *numParams);
|
|
|
|
extern Query *parse_sub_analyze(Node *parseTree, ParseState *parentParseState,
|
|
CommonTableExpr *parentCTE,
|
|
bool locked_from_parent);
|
|
|
|
extern Query *transformTopLevelStmt(ParseState *pstate, Node *parseTree);
|
|
extern Query *transformStmt(ParseState *pstate, Node *parseTree);
|
|
|
|
extern bool analyze_requires_snapshot(Node *parseTree);
|
|
|
|
extern void CheckSelectLocking(Query *qry);
|
|
extern void applyLockingClause(Query *qry, Index rtindex,
|
|
bool forUpdate, bool noWait, bool pushedDown);
|
|
|
|
#endif /* ANALYZE_H */
|