init
This commit is contained in:
1
db_include/parser/.gitignore
vendored
Executable file
1
db_include/parser/.gitignore
vendored
Executable file
@@ -0,0 +1 @@
|
||||
/gram.h
|
||||
53
db_include/parser/analyze.h
Executable file
53
db_include/parser/analyze.h
Executable file
@@ -0,0 +1,53 @@
|
||||
/*-------------------------------------------------------------------------
|
||||
*
|
||||
* analyze.h
|
||||
* parse analysis for optimizable statements
|
||||
*
|
||||
*
|
||||
* Portions Copyright (c) 1996-2021, 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"
|
||||
#include "utils/queryjumble.h"
|
||||
|
||||
/* Hook for plugins to get control at end of parse analysis */
|
||||
typedef void (*post_parse_analyze_hook_type) (ParseState *pstate,
|
||||
Query *query,
|
||||
JumbleState *jstate);
|
||||
extern PGDLLIMPORT post_parse_analyze_hook_type post_parse_analyze_hook;
|
||||
|
||||
|
||||
extern Query *parse_analyze(RawStmt *parseTree, const char *sourceText,
|
||||
Oid *paramTypes, int numParams, QueryEnvironment *queryEnv);
|
||||
extern Query *parse_analyze_varparams(RawStmt *parseTree, const char *sourceText,
|
||||
Oid **paramTypes, int *numParams);
|
||||
|
||||
extern Query *parse_sub_analyze(Node *parseTree, ParseState *parentParseState,
|
||||
CommonTableExpr *parentCTE,
|
||||
bool locked_from_parent,
|
||||
bool resolve_unknowns);
|
||||
|
||||
extern Query *transformTopLevelStmt(ParseState *pstate, RawStmt *parseTree);
|
||||
extern Query *transformStmt(ParseState *pstate, Node *parseTree);
|
||||
|
||||
extern bool analyze_requires_snapshot(RawStmt *parseTree);
|
||||
|
||||
extern const char *LCS_asString(LockClauseStrength strength);
|
||||
extern void CheckSelectLocking(Query *qry, LockClauseStrength strength);
|
||||
extern void applyLockingClause(Query *qry, Index rtindex,
|
||||
LockClauseStrength strength,
|
||||
LockWaitPolicy waitPolicy, bool pushedDown);
|
||||
|
||||
extern List *BuildOnConflictExcludedTargetlist(Relation targetrel,
|
||||
Index exclRelIndex);
|
||||
|
||||
extern SortGroupClause *makeSortGroupClauseForSetOp(Oid rescoltype, bool require_hash);
|
||||
|
||||
#endif /* ANALYZE_H */
|
||||
75
db_include/parser/gramparse.h
Executable file
75
db_include/parser/gramparse.h
Executable file
@@ -0,0 +1,75 @@
|
||||
/*-------------------------------------------------------------------------
|
||||
*
|
||||
* gramparse.h
|
||||
* Shared definitions for the "raw" parser (flex and bison phases only)
|
||||
*
|
||||
* NOTE: this file is only meant to be included in the core parsing files,
|
||||
* ie, parser.c, gram.y, scan.l, and src/common/keywords.c.
|
||||
* Definitions that are needed outside the core parser should be in parser.h.
|
||||
*
|
||||
*
|
||||
* Portions Copyright (c) 1996-2021, PostgreSQL Global Development Group
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* src/include/parser/gramparse.h
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#ifndef GRAMPARSE_H
|
||||
#define GRAMPARSE_H
|
||||
|
||||
#include "nodes/parsenodes.h"
|
||||
#include "parser/scanner.h"
|
||||
|
||||
/*
|
||||
* NB: include gram.h only AFTER including scanner.h, because scanner.h
|
||||
* is what #defines YYLTYPE.
|
||||
*/
|
||||
#include "parser/gram.h"
|
||||
|
||||
/*
|
||||
* The YY_EXTRA data that a flex scanner allows us to pass around. Private
|
||||
* state needed for raw parsing/lexing goes here.
|
||||
*/
|
||||
typedef struct base_yy_extra_type
|
||||
{
|
||||
/*
|
||||
* Fields used by the core scanner.
|
||||
*/
|
||||
core_yy_extra_type core_yy_extra;
|
||||
|
||||
/*
|
||||
* State variables for base_yylex().
|
||||
*/
|
||||
bool have_lookahead; /* is lookahead info valid? */
|
||||
int lookahead_token; /* one-token lookahead */
|
||||
core_YYSTYPE lookahead_yylval; /* yylval for lookahead token */
|
||||
YYLTYPE lookahead_yylloc; /* yylloc for lookahead token */
|
||||
char *lookahead_end; /* end of current token */
|
||||
char lookahead_hold_char; /* to be put back at *lookahead_end */
|
||||
|
||||
/*
|
||||
* State variables that belong to the grammar.
|
||||
*/
|
||||
List *parsetree; /* final parse result is delivered here */
|
||||
} base_yy_extra_type;
|
||||
|
||||
/*
|
||||
* In principle we should use yyget_extra() to fetch the yyextra field
|
||||
* from a yyscanner struct. However, flex always puts that field first,
|
||||
* and this is sufficiently performance-critical to make it seem worth
|
||||
* cheating a bit to use an inline macro.
|
||||
*/
|
||||
#define pg_yyget_extra(yyscanner) (*((base_yy_extra_type **) (yyscanner)))
|
||||
|
||||
|
||||
/* from parser.c */
|
||||
extern int base_yylex(YYSTYPE *lvalp, YYLTYPE *llocp,
|
||||
core_yyscan_t yyscanner);
|
||||
|
||||
/* from gram.y */
|
||||
extern void parser_init(base_yy_extra_type *yyext);
|
||||
extern int base_yyparse(core_yyscan_t yyscanner);
|
||||
|
||||
#endif /* GRAMPARSE_H */
|
||||
484
db_include/parser/kwlist.h
Executable file
484
db_include/parser/kwlist.h
Executable file
@@ -0,0 +1,484 @@
|
||||
/*-------------------------------------------------------------------------
|
||||
*
|
||||
* kwlist.h
|
||||
*
|
||||
* The keyword lists are kept in their own source files for use by
|
||||
* automatic tools. The exact representation of a keyword is determined
|
||||
* by the PG_KEYWORD macro, which is not defined in this file; it can
|
||||
* be defined by the caller for special purposes.
|
||||
*
|
||||
* Portions Copyright (c) 1996-2021, PostgreSQL Global Development Group
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* src/include/parser/kwlist.h
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* there is deliberately not an #ifndef KWLIST_H here */
|
||||
|
||||
/*
|
||||
* List of keyword (name, token-value, category, bare-label-status) entries.
|
||||
*
|
||||
* Note: gen_keywordlist.pl requires the entries to appear in ASCII order.
|
||||
*/
|
||||
|
||||
/* name, value, category, is-bare-label */
|
||||
PG_KEYWORD("abort", ABORT_P, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("absolute", ABSOLUTE_P, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("access", ACCESS, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("action", ACTION, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("add", ADD_P, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("admin", ADMIN, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("after", AFTER, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("aggregate", AGGREGATE, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("all", ALL, RESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("also", ALSO, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("alter", ALTER, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("always", ALWAYS, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("analyse", ANALYSE, RESERVED_KEYWORD, BARE_LABEL) /* British spelling */
|
||||
PG_KEYWORD("analyze", ANALYZE, RESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("and", AND, RESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("any", ANY, RESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("array", ARRAY, RESERVED_KEYWORD, AS_LABEL)
|
||||
PG_KEYWORD("as", AS, RESERVED_KEYWORD, AS_LABEL)
|
||||
PG_KEYWORD("asc", ASC, RESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("asensitive", ASENSITIVE, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("assertion", ASSERTION, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("assignment", ASSIGNMENT, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("asymmetric", ASYMMETRIC, RESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("at", AT, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("atomic", ATOMIC, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("attach", ATTACH, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("attribute", ATTRIBUTE, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("authorization", AUTHORIZATION, TYPE_FUNC_NAME_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("backward", BACKWARD, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("before", BEFORE, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("begin", BEGIN_P, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("between", BETWEEN, COL_NAME_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("bigint", BIGINT, COL_NAME_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("binary", BINARY, TYPE_FUNC_NAME_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("bit", BIT, COL_NAME_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("boolean", BOOLEAN_P, COL_NAME_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("both", BOTH, RESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("breadth", BREADTH, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("by", BY, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("cache", CACHE, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("call", CALL, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("called", CALLED, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("cascade", CASCADE, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("cascaded", CASCADED, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("case", CASE, RESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("cast", CAST, RESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("catalog", CATALOG_P, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("chain", CHAIN, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("char", CHAR_P, COL_NAME_KEYWORD, AS_LABEL)
|
||||
PG_KEYWORD("character", CHARACTER, COL_NAME_KEYWORD, AS_LABEL)
|
||||
PG_KEYWORD("characteristics", CHARACTERISTICS, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("check", CHECK, RESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("checkpoint", CHECKPOINT, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("class", CLASS, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("close", CLOSE, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("cluster", CLUSTER, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("coalesce", COALESCE, COL_NAME_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("collate", COLLATE, RESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("collation", COLLATION, TYPE_FUNC_NAME_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("column", COLUMN, RESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("columns", COLUMNS, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("comment", COMMENT, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("comments", COMMENTS, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("commit", COMMIT, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("committed", COMMITTED, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("compression", COMPRESSION, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("concurrently", CONCURRENTLY, TYPE_FUNC_NAME_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("configuration", CONFIGURATION, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("conflict", CONFLICT, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("connection", CONNECTION, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("constraint", CONSTRAINT, RESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("constraints", CONSTRAINTS, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("content", CONTENT_P, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("continue", CONTINUE_P, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("conversion", CONVERSION_P, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("copy", COPY, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("cost", COST, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("create", CREATE, RESERVED_KEYWORD, AS_LABEL)
|
||||
PG_KEYWORD("cross", CROSS, TYPE_FUNC_NAME_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("csv", CSV, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("cube", CUBE, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("current", CURRENT_P, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("current_catalog", CURRENT_CATALOG, RESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("current_date", CURRENT_DATE, RESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("current_role", CURRENT_ROLE, RESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("current_schema", CURRENT_SCHEMA, TYPE_FUNC_NAME_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("current_time", CURRENT_TIME, RESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("current_timestamp", CURRENT_TIMESTAMP, RESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("current_user", CURRENT_USER, RESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("cursor", CURSOR, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("cycle", CYCLE, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("data", DATA_P, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("database", DATABASE, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("day", DAY_P, UNRESERVED_KEYWORD, AS_LABEL)
|
||||
PG_KEYWORD("deallocate", DEALLOCATE, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("dec", DEC, COL_NAME_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("decimal", DECIMAL_P, COL_NAME_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("declare", DECLARE, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("default", DEFAULT, RESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("defaults", DEFAULTS, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("deferrable", DEFERRABLE, RESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("deferred", DEFERRED, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("definer", DEFINER, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("delete", DELETE_P, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("delimiter", DELIMITER, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("delimiters", DELIMITERS, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("depends", DEPENDS, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("depth", DEPTH, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("desc", DESC, RESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("detach", DETACH, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("dictionary", DICTIONARY, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("disable", DISABLE_P, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("discard", DISCARD, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("distinct", DISTINCT, RESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("do", DO, RESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("document", DOCUMENT_P, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("domain", DOMAIN_P, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("double", DOUBLE_P, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("drop", DROP, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("each", EACH, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("else", ELSE, RESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("enable", ENABLE_P, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("encoding", ENCODING, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("encrypted", ENCRYPTED, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("end", END_P, RESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("enum", ENUM_P, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("escape", ESCAPE, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("event", EVENT, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("except", EXCEPT, RESERVED_KEYWORD, AS_LABEL)
|
||||
PG_KEYWORD("exclude", EXCLUDE, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("excluding", EXCLUDING, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("exclusive", EXCLUSIVE, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("execute", EXECUTE, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("exists", EXISTS, COL_NAME_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("explain", EXPLAIN, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("expression", EXPRESSION, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("extension", EXTENSION, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("external", EXTERNAL, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("extract", EXTRACT, COL_NAME_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("false", FALSE_P, RESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("family", FAMILY, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("fetch", FETCH, RESERVED_KEYWORD, AS_LABEL)
|
||||
PG_KEYWORD("filter", FILTER, UNRESERVED_KEYWORD, AS_LABEL)
|
||||
PG_KEYWORD("finalize", FINALIZE, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("first", FIRST_P, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("float", FLOAT_P, COL_NAME_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("following", FOLLOWING, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("for", FOR, RESERVED_KEYWORD, AS_LABEL)
|
||||
PG_KEYWORD("force", FORCE, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("foreign", FOREIGN, RESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("forward", FORWARD, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("freeze", FREEZE, TYPE_FUNC_NAME_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("from", FROM, RESERVED_KEYWORD, AS_LABEL)
|
||||
PG_KEYWORD("full", FULL, TYPE_FUNC_NAME_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("function", FUNCTION, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("functions", FUNCTIONS, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("generated", GENERATED, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("global", GLOBAL, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("grant", GRANT, RESERVED_KEYWORD, AS_LABEL)
|
||||
PG_KEYWORD("granted", GRANTED, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("greatest", GREATEST, COL_NAME_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("group", GROUP_P, RESERVED_KEYWORD, AS_LABEL)
|
||||
PG_KEYWORD("grouping", GROUPING, COL_NAME_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("groups", GROUPS, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("handler", HANDLER, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("having", HAVING, RESERVED_KEYWORD, AS_LABEL)
|
||||
PG_KEYWORD("header", HEADER_P, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("hold", HOLD, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("hour", HOUR_P, UNRESERVED_KEYWORD, AS_LABEL)
|
||||
PG_KEYWORD("identity", IDENTITY_P, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("if", IF_P, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("ilike", ILIKE, TYPE_FUNC_NAME_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("immediate", IMMEDIATE, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("immutable", IMMUTABLE, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("implicit", IMPLICIT_P, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("import", IMPORT_P, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("in", IN_P, RESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("include", INCLUDE, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("including", INCLUDING, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("increment", INCREMENT, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("index", INDEX, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("indexes", INDEXES, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("inherit", INHERIT, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("inherits", INHERITS, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("initially", INITIALLY, RESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("inline", INLINE_P, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("inner", INNER_P, TYPE_FUNC_NAME_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("inout", INOUT, COL_NAME_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("input", INPUT_P, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("insensitive", INSENSITIVE, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("insert", INSERT, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("instead", INSTEAD, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("int", INT_P, COL_NAME_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("integer", INTEGER, COL_NAME_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("intersect", INTERSECT, RESERVED_KEYWORD, AS_LABEL)
|
||||
PG_KEYWORD("interval", INTERVAL, COL_NAME_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("into", INTO, RESERVED_KEYWORD, AS_LABEL)
|
||||
PG_KEYWORD("invoker", INVOKER, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("is", IS, TYPE_FUNC_NAME_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("isnull", ISNULL, TYPE_FUNC_NAME_KEYWORD, AS_LABEL)
|
||||
PG_KEYWORD("isolation", ISOLATION, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("join", JOIN, TYPE_FUNC_NAME_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("key", KEY, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("label", LABEL, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("language", LANGUAGE, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("large", LARGE_P, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("last", LAST_P, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("lateral", LATERAL_P, RESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("leading", LEADING, RESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("leakproof", LEAKPROOF, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("least", LEAST, COL_NAME_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("left", LEFT, TYPE_FUNC_NAME_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("level", LEVEL, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("like", LIKE, TYPE_FUNC_NAME_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("limit", LIMIT, RESERVED_KEYWORD, AS_LABEL)
|
||||
PG_KEYWORD("listen", LISTEN, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("load", LOAD, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("local", LOCAL, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("localtime", LOCALTIME, RESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("localtimestamp", LOCALTIMESTAMP, RESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("location", LOCATION, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("lock", LOCK_P, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("locked", LOCKED, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("logged", LOGGED, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("mapping", MAPPING, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("match", MATCH, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("materialized", MATERIALIZED, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("maxvalue", MAXVALUE, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("method", METHOD, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("minute", MINUTE_P, UNRESERVED_KEYWORD, AS_LABEL)
|
||||
PG_KEYWORD("minvalue", MINVALUE, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("mode", MODE, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("month", MONTH_P, UNRESERVED_KEYWORD, AS_LABEL)
|
||||
PG_KEYWORD("move", MOVE, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("name", NAME_P, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("names", NAMES, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("national", NATIONAL, COL_NAME_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("natural", NATURAL, TYPE_FUNC_NAME_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("nchar", NCHAR, COL_NAME_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("new", NEW, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("next", NEXT, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("nfc", NFC, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("nfd", NFD, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("nfkc", NFKC, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("nfkd", NFKD, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("no", NO, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("none", NONE, COL_NAME_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("normalize", NORMALIZE, COL_NAME_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("normalized", NORMALIZED, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("not", NOT, RESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("nothing", NOTHING, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("notify", NOTIFY, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("notnull", NOTNULL, TYPE_FUNC_NAME_KEYWORD, AS_LABEL)
|
||||
PG_KEYWORD("nowait", NOWAIT, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("null", NULL_P, RESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("nullif", NULLIF, COL_NAME_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("nulls", NULLS_P, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("numeric", NUMERIC, COL_NAME_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("object", OBJECT_P, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("of", OF, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("off", OFF, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("offset", OFFSET, RESERVED_KEYWORD, AS_LABEL)
|
||||
PG_KEYWORD("oids", OIDS, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("old", OLD, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("on", ON, RESERVED_KEYWORD, AS_LABEL)
|
||||
PG_KEYWORD("only", ONLY, RESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("operator", OPERATOR, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("option", OPTION, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("options", OPTIONS, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("or", OR, RESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("order", ORDER, RESERVED_KEYWORD, AS_LABEL)
|
||||
PG_KEYWORD("ordinality", ORDINALITY, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("others", OTHERS, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("out", OUT_P, COL_NAME_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("outer", OUTER_P, TYPE_FUNC_NAME_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("over", OVER, UNRESERVED_KEYWORD, AS_LABEL)
|
||||
PG_KEYWORD("overlaps", OVERLAPS, TYPE_FUNC_NAME_KEYWORD, AS_LABEL)
|
||||
PG_KEYWORD("overlay", OVERLAY, COL_NAME_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("overriding", OVERRIDING, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("owned", OWNED, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("owner", OWNER, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("parallel", PARALLEL, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("parser", PARSER, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("partial", PARTIAL, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("partition", PARTITION, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("passing", PASSING, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("password", PASSWORD, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("placing", PLACING, RESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("plans", PLANS, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("policy", POLICY, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("position", POSITION, COL_NAME_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("preceding", PRECEDING, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("precision", PRECISION, COL_NAME_KEYWORD, AS_LABEL)
|
||||
PG_KEYWORD("prepare", PREPARE, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("prepared", PREPARED, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("preserve", PRESERVE, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("primary", PRIMARY, RESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("prior", PRIOR, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("privileges", PRIVILEGES, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("procedural", PROCEDURAL, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("procedure", PROCEDURE, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("procedures", PROCEDURES, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("program", PROGRAM, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("publication", PUBLICATION, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("quote", QUOTE, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("range", RANGE, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("read", READ, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("real", REAL, COL_NAME_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("reassign", REASSIGN, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("recheck", RECHECK, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("recursive", RECURSIVE, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("ref", REF, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("references", REFERENCES, RESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("referencing", REFERENCING, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("refresh", REFRESH, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("reindex", REINDEX, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("relative", RELATIVE_P, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("release", RELEASE, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("rename", RENAME, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("repeatable", REPEATABLE, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("replace", REPLACE, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("replica", REPLICA, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("reset", RESET, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("restart", RESTART, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("restrict", RESTRICT, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("return", RETURN, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("returning", RETURNING, RESERVED_KEYWORD, AS_LABEL)
|
||||
PG_KEYWORD("returns", RETURNS, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("revoke", REVOKE, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("right", RIGHT, TYPE_FUNC_NAME_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("role", ROLE, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("rollback", ROLLBACK, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("rollup", ROLLUP, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("routine", ROUTINE, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("routines", ROUTINES, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("row", ROW, COL_NAME_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("rows", ROWS, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("rule", RULE, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("savepoint", SAVEPOINT, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("schema", SCHEMA, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("schemas", SCHEMAS, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("scroll", SCROLL, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("search", SEARCH, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("second", SECOND_P, UNRESERVED_KEYWORD, AS_LABEL)
|
||||
PG_KEYWORD("security", SECURITY, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("select", SELECT, RESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("sequence", SEQUENCE, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("sequences", SEQUENCES, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("serializable", SERIALIZABLE, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("server", SERVER, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("session", SESSION, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("session_user", SESSION_USER, RESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("set", SET, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("setof", SETOF, COL_NAME_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("sets", SETS, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("share", SHARE, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("show", SHOW, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("similar", SIMILAR, TYPE_FUNC_NAME_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("simple", SIMPLE, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("skip", SKIP, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("smallint", SMALLINT, COL_NAME_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("snapshot", SNAPSHOT, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("some", SOME, RESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("sql", SQL_P, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("stable", STABLE, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("standalone", STANDALONE_P, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("start", START, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("statement", STATEMENT, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("statistics", STATISTICS, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("stdin", STDIN, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("stdout", STDOUT, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("storage", STORAGE, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("stored", STORED, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("strict", STRICT_P, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("strip", STRIP_P, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("subscription", SUBSCRIPTION, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("substring", SUBSTRING, COL_NAME_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("support", SUPPORT, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("symmetric", SYMMETRIC, RESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("sysid", SYSID, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("system", SYSTEM_P, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("table", TABLE, RESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("tables", TABLES, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("tablesample", TABLESAMPLE, TYPE_FUNC_NAME_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("tablespace", TABLESPACE, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("temp", TEMP, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("template", TEMPLATE, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("temporary", TEMPORARY, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("text", TEXT_P, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("then", THEN, RESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("ties", TIES, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("time", TIME, COL_NAME_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("timestamp", TIMESTAMP, COL_NAME_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("to", TO, RESERVED_KEYWORD, AS_LABEL)
|
||||
PG_KEYWORD("trailing", TRAILING, RESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("transaction", TRANSACTION, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("transform", TRANSFORM, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("treat", TREAT, COL_NAME_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("trigger", TRIGGER, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("trim", TRIM, COL_NAME_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("true", TRUE_P, RESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("truncate", TRUNCATE, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("trusted", TRUSTED, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("type", TYPE_P, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("types", TYPES_P, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("uescape", UESCAPE, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("unbounded", UNBOUNDED, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("uncommitted", UNCOMMITTED, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("unencrypted", UNENCRYPTED, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("union", UNION, RESERVED_KEYWORD, AS_LABEL)
|
||||
PG_KEYWORD("unique", UNIQUE, RESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("unknown", UNKNOWN, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("unlisten", UNLISTEN, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("unlogged", UNLOGGED, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("until", UNTIL, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("update", UPDATE, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("user", USER, RESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("using", USING, RESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("vacuum", VACUUM, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("valid", VALID, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("validate", VALIDATE, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("validator", VALIDATOR, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("value", VALUE_P, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("values", VALUES, COL_NAME_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("varchar", VARCHAR, COL_NAME_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("variadic", VARIADIC, RESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("varying", VARYING, UNRESERVED_KEYWORD, AS_LABEL)
|
||||
PG_KEYWORD("verbose", VERBOSE, TYPE_FUNC_NAME_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("version", VERSION_P, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("view", VIEW, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("views", VIEWS, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("volatile", VOLATILE, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("when", WHEN, RESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("where", WHERE, RESERVED_KEYWORD, AS_LABEL)
|
||||
PG_KEYWORD("whitespace", WHITESPACE_P, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("window", WINDOW, RESERVED_KEYWORD, AS_LABEL)
|
||||
PG_KEYWORD("with", WITH, RESERVED_KEYWORD, AS_LABEL)
|
||||
PG_KEYWORD("within", WITHIN, UNRESERVED_KEYWORD, AS_LABEL)
|
||||
PG_KEYWORD("without", WITHOUT, UNRESERVED_KEYWORD, AS_LABEL)
|
||||
PG_KEYWORD("work", WORK, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("wrapper", WRAPPER, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("write", WRITE, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("xml", XML_P, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("xmlattributes", XMLATTRIBUTES, COL_NAME_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("xmlconcat", XMLCONCAT, COL_NAME_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("xmlelement", XMLELEMENT, COL_NAME_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("xmlexists", XMLEXISTS, COL_NAME_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("xmlforest", XMLFOREST, COL_NAME_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("xmlnamespaces", XMLNAMESPACES, COL_NAME_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("xmlparse", XMLPARSE, COL_NAME_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("xmlpi", XMLPI, COL_NAME_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("xmlroot", XMLROOT, COL_NAME_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("xmlserialize", XMLSERIALIZE, COL_NAME_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("xmltable", XMLTABLE, COL_NAME_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("year", YEAR_P, UNRESERVED_KEYWORD, AS_LABEL)
|
||||
PG_KEYWORD("yes", YES_P, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
PG_KEYWORD("zone", ZONE, UNRESERVED_KEYWORD, BARE_LABEL)
|
||||
68
db_include/parser/parse_agg.h
Executable file
68
db_include/parser/parse_agg.h
Executable file
@@ -0,0 +1,68 @@
|
||||
/*-------------------------------------------------------------------------
|
||||
*
|
||||
* parse_agg.h
|
||||
* handle aggregates and window functions in parser
|
||||
*
|
||||
* Portions Copyright (c) 1996-2021, PostgreSQL Global Development Group
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* src/include/parser/parse_agg.h
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
#ifndef PARSE_AGG_H
|
||||
#define PARSE_AGG_H
|
||||
|
||||
#include "parser/parse_node.h"
|
||||
|
||||
extern void transformAggregateCall(ParseState *pstate, Aggref *agg,
|
||||
List *args, List *aggorder,
|
||||
bool agg_distinct);
|
||||
|
||||
extern Node *transformGroupingFunc(ParseState *pstate, GroupingFunc *g);
|
||||
|
||||
extern void transformWindowFuncCall(ParseState *pstate, WindowFunc *wfunc,
|
||||
WindowDef *windef);
|
||||
|
||||
extern void parseCheckAggregates(ParseState *pstate, Query *qry);
|
||||
|
||||
extern List *expand_grouping_sets(List *groupingSets, bool groupDistinct, int limit);
|
||||
|
||||
extern int get_aggregate_argtypes(Aggref *aggref, Oid *inputTypes);
|
||||
|
||||
extern Oid resolve_aggregate_transtype(Oid aggfuncid,
|
||||
Oid aggtranstype,
|
||||
Oid *inputTypes,
|
||||
int numArguments);
|
||||
|
||||
extern void build_aggregate_transfn_expr(Oid *agg_input_types,
|
||||
int agg_num_inputs,
|
||||
int agg_num_direct_inputs,
|
||||
bool agg_variadic,
|
||||
Oid agg_state_type,
|
||||
Oid agg_input_collation,
|
||||
Oid transfn_oid,
|
||||
Oid invtransfn_oid,
|
||||
Expr **transfnexpr,
|
||||
Expr **invtransfnexpr);
|
||||
|
||||
extern void build_aggregate_combinefn_expr(Oid agg_state_type,
|
||||
Oid agg_input_collation,
|
||||
Oid combinefn_oid,
|
||||
Expr **combinefnexpr);
|
||||
|
||||
extern void build_aggregate_serialfn_expr(Oid serialfn_oid,
|
||||
Expr **serialfnexpr);
|
||||
|
||||
extern void build_aggregate_deserialfn_expr(Oid deserialfn_oid,
|
||||
Expr **deserialfnexpr);
|
||||
|
||||
extern void build_aggregate_finalfn_expr(Oid *agg_input_types,
|
||||
int num_finalfn_inputs,
|
||||
Oid agg_state_type,
|
||||
Oid agg_result_type,
|
||||
Oid agg_input_collation,
|
||||
Oid finalfn_oid,
|
||||
Expr **finalfnexpr);
|
||||
|
||||
#endif /* PARSE_AGG_H */
|
||||
54
db_include/parser/parse_clause.h
Executable file
54
db_include/parser/parse_clause.h
Executable file
@@ -0,0 +1,54 @@
|
||||
/*-------------------------------------------------------------------------
|
||||
*
|
||||
* parse_clause.h
|
||||
* handle clauses in parser
|
||||
*
|
||||
*
|
||||
* Portions Copyright (c) 1996-2021, PostgreSQL Global Development Group
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* src/include/parser/parse_clause.h
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
#ifndef PARSE_CLAUSE_H
|
||||
#define PARSE_CLAUSE_H
|
||||
|
||||
#include "parser/parse_node.h"
|
||||
|
||||
extern void transformFromClause(ParseState *pstate, List *frmList);
|
||||
extern int setTargetTable(ParseState *pstate, RangeVar *relation,
|
||||
bool inh, bool alsoSource, AclMode requiredPerms);
|
||||
|
||||
extern Node *transformWhereClause(ParseState *pstate, Node *clause,
|
||||
ParseExprKind exprKind, const char *constructName);
|
||||
extern Node *transformLimitClause(ParseState *pstate, Node *clause,
|
||||
ParseExprKind exprKind, const char *constructName,
|
||||
LimitOption limitOption);
|
||||
extern List *transformGroupClause(ParseState *pstate, List *grouplist,
|
||||
List **groupingSets,
|
||||
List **targetlist, List *sortClause,
|
||||
ParseExprKind exprKind, bool useSQL99);
|
||||
extern List *transformSortClause(ParseState *pstate, List *orderlist,
|
||||
List **targetlist, ParseExprKind exprKind,
|
||||
bool useSQL99);
|
||||
|
||||
extern List *transformWindowDefinitions(ParseState *pstate,
|
||||
List *windowdefs,
|
||||
List **targetlist);
|
||||
|
||||
extern List *transformDistinctClause(ParseState *pstate,
|
||||
List **targetlist, List *sortClause, bool is_agg);
|
||||
extern List *transformDistinctOnClause(ParseState *pstate, List *distinctlist,
|
||||
List **targetlist, List *sortClause);
|
||||
extern void transformOnConflictArbiter(ParseState *pstate,
|
||||
OnConflictClause *onConflictClause,
|
||||
List **arbiterExpr, Node **arbiterWhere,
|
||||
Oid *constraint);
|
||||
|
||||
extern List *addTargetToSortList(ParseState *pstate, TargetEntry *tle,
|
||||
List *sortlist, List *targetlist, SortBy *sortby);
|
||||
extern Index assignSortGroupRef(TargetEntry *tle, List *tlist);
|
||||
extern bool targetIsInSortList(TargetEntry *tle, Oid sortop, List *sortList);
|
||||
|
||||
#endif /* PARSE_CLAUSE_H */
|
||||
100
db_include/parser/parse_coerce.h
Executable file
100
db_include/parser/parse_coerce.h
Executable file
@@ -0,0 +1,100 @@
|
||||
/*-------------------------------------------------------------------------
|
||||
*
|
||||
* parse_coerce.h
|
||||
* Routines for type coercion.
|
||||
*
|
||||
*
|
||||
* Portions Copyright (c) 1996-2021, PostgreSQL Global Development Group
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* src/include/parser/parse_coerce.h
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
#ifndef PARSE_COERCE_H
|
||||
#define PARSE_COERCE_H
|
||||
|
||||
#include "parser/parse_node.h"
|
||||
|
||||
|
||||
/* Type categories (see TYPCATEGORY_xxx symbols in catalog/pg_type.h) */
|
||||
typedef char TYPCATEGORY;
|
||||
|
||||
/* Result codes for find_coercion_pathway */
|
||||
typedef enum CoercionPathType
|
||||
{
|
||||
COERCION_PATH_NONE, /* failed to find any coercion pathway */
|
||||
COERCION_PATH_FUNC, /* apply the specified coercion function */
|
||||
COERCION_PATH_RELABELTYPE, /* binary-compatible cast, no function */
|
||||
COERCION_PATH_ARRAYCOERCE, /* need an ArrayCoerceExpr node */
|
||||
COERCION_PATH_COERCEVIAIO /* need a CoerceViaIO node */
|
||||
} CoercionPathType;
|
||||
|
||||
|
||||
extern bool IsBinaryCoercible(Oid srctype, Oid targettype);
|
||||
extern bool IsPreferredType(TYPCATEGORY category, Oid type);
|
||||
extern TYPCATEGORY TypeCategory(Oid type);
|
||||
|
||||
extern Node *coerce_to_target_type(ParseState *pstate,
|
||||
Node *expr, Oid exprtype,
|
||||
Oid targettype, int32 targettypmod,
|
||||
CoercionContext ccontext,
|
||||
CoercionForm cformat,
|
||||
int location);
|
||||
extern bool can_coerce_type(int nargs, const Oid *input_typeids, const Oid *target_typeids,
|
||||
CoercionContext ccontext);
|
||||
extern Node *coerce_type(ParseState *pstate, Node *node,
|
||||
Oid inputTypeId, Oid targetTypeId, int32 targetTypeMod,
|
||||
CoercionContext ccontext, CoercionForm cformat, int location);
|
||||
extern Node *coerce_to_domain(Node *arg, Oid baseTypeId, int32 baseTypeMod,
|
||||
Oid typeId,
|
||||
CoercionContext ccontext, CoercionForm cformat, int location,
|
||||
bool hideInputCoercion);
|
||||
|
||||
extern Node *coerce_to_boolean(ParseState *pstate, Node *node,
|
||||
const char *constructName);
|
||||
extern Node *coerce_to_specific_type(ParseState *pstate, Node *node,
|
||||
Oid targetTypeId,
|
||||
const char *constructName);
|
||||
|
||||
extern Node *coerce_to_specific_type_typmod(ParseState *pstate, Node *node,
|
||||
Oid targetTypeId, int32 targetTypmod,
|
||||
const char *constructName);
|
||||
|
||||
extern int parser_coercion_errposition(ParseState *pstate,
|
||||
int coerce_location,
|
||||
Node *input_expr);
|
||||
|
||||
extern Oid select_common_type(ParseState *pstate, List *exprs,
|
||||
const char *context, Node **which_expr);
|
||||
extern Node *coerce_to_common_type(ParseState *pstate, Node *node,
|
||||
Oid targetTypeId,
|
||||
const char *context);
|
||||
extern bool verify_common_type(Oid common_type, List *exprs);
|
||||
|
||||
extern int32 select_common_typmod(ParseState *pstate, List *exprs, Oid common_type);
|
||||
|
||||
extern bool check_generic_type_consistency(const Oid *actual_arg_types,
|
||||
const Oid *declared_arg_types,
|
||||
int nargs);
|
||||
extern Oid enforce_generic_type_consistency(const Oid *actual_arg_types,
|
||||
Oid *declared_arg_types,
|
||||
int nargs,
|
||||
Oid rettype,
|
||||
bool allow_poly);
|
||||
|
||||
extern char *check_valid_polymorphic_signature(Oid ret_type,
|
||||
const Oid *declared_arg_types,
|
||||
int nargs);
|
||||
extern char *check_valid_internal_signature(Oid ret_type,
|
||||
const Oid *declared_arg_types,
|
||||
int nargs);
|
||||
|
||||
extern CoercionPathType find_coercion_pathway(Oid targetTypeId,
|
||||
Oid sourceTypeId,
|
||||
CoercionContext ccontext,
|
||||
Oid *funcid);
|
||||
extern CoercionPathType find_typmod_coercion_function(Oid typeId,
|
||||
Oid *funcid);
|
||||
|
||||
#endif /* PARSE_COERCE_H */
|
||||
27
db_include/parser/parse_collate.h
Executable file
27
db_include/parser/parse_collate.h
Executable file
@@ -0,0 +1,27 @@
|
||||
/*-------------------------------------------------------------------------
|
||||
*
|
||||
* parse_collate.h
|
||||
* Routines for assigning collation information.
|
||||
*
|
||||
*
|
||||
* Portions Copyright (c) 1996-2021, PostgreSQL Global Development Group
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* src/include/parser/parse_collate.h
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
#ifndef PARSE_COLLATE_H
|
||||
#define PARSE_COLLATE_H
|
||||
|
||||
#include "parser/parse_node.h"
|
||||
|
||||
extern void assign_query_collations(ParseState *pstate, Query *query);
|
||||
|
||||
extern void assign_list_collations(ParseState *pstate, List *exprs);
|
||||
|
||||
extern void assign_expr_collations(ParseState *pstate, Node *expr);
|
||||
|
||||
extern Oid select_common_collation(ParseState *pstate, List *exprs, bool none_ok);
|
||||
|
||||
#endif /* PARSE_COLLATE_H */
|
||||
24
db_include/parser/parse_cte.h
Executable file
24
db_include/parser/parse_cte.h
Executable file
@@ -0,0 +1,24 @@
|
||||
/*-------------------------------------------------------------------------
|
||||
*
|
||||
* parse_cte.h
|
||||
* handle CTEs (common table expressions) in parser
|
||||
*
|
||||
*
|
||||
* Portions Copyright (c) 1996-2021, PostgreSQL Global Development Group
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* src/include/parser/parse_cte.h
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
#ifndef PARSE_CTE_H
|
||||
#define PARSE_CTE_H
|
||||
|
||||
#include "parser/parse_node.h"
|
||||
|
||||
extern List *transformWithClause(ParseState *pstate, WithClause *withClause);
|
||||
|
||||
extern void analyzeCTETargetList(ParseState *pstate, CommonTableExpr *cte,
|
||||
List *tlist);
|
||||
|
||||
#endif /* PARSE_CTE_H */
|
||||
22
db_include/parser/parse_enr.h
Executable file
22
db_include/parser/parse_enr.h
Executable file
@@ -0,0 +1,22 @@
|
||||
/*-------------------------------------------------------------------------
|
||||
*
|
||||
* parse_enr.h
|
||||
* Internal definitions for parser
|
||||
*
|
||||
*
|
||||
* Portions Copyright (c) 1996-2021, PostgreSQL Global Development Group
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* src/include/parser/parse_enr.h
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
#ifndef PARSE_ENR_H
|
||||
#define PARSE_ENR_H
|
||||
|
||||
#include "parser/parse_node.h"
|
||||
|
||||
extern bool name_matches_visible_ENR(ParseState *pstate, const char *refname);
|
||||
extern EphemeralNamedRelationMetadata get_visible_ENR(ParseState *pstate, const char *refname);
|
||||
|
||||
#endif /* PARSE_ENR_H */
|
||||
25
db_include/parser/parse_expr.h
Executable file
25
db_include/parser/parse_expr.h
Executable file
@@ -0,0 +1,25 @@
|
||||
/*-------------------------------------------------------------------------
|
||||
*
|
||||
* parse_expr.h
|
||||
* handle expressions in parser
|
||||
*
|
||||
* Portions Copyright (c) 1996-2021, PostgreSQL Global Development Group
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* src/include/parser/parse_expr.h
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
#ifndef PARSE_EXPR_H
|
||||
#define PARSE_EXPR_H
|
||||
|
||||
#include "parser/parse_node.h"
|
||||
|
||||
/* GUC parameters */
|
||||
extern bool Transform_null_equals;
|
||||
|
||||
extern Node *transformExpr(ParseState *pstate, Node *expr, ParseExprKind exprKind);
|
||||
|
||||
extern const char *ParseExprKindName(ParseExprKind exprKind);
|
||||
|
||||
#endif /* PARSE_EXPR_H */
|
||||
74
db_include/parser/parse_func.h
Executable file
74
db_include/parser/parse_func.h
Executable file
@@ -0,0 +1,74 @@
|
||||
/*-------------------------------------------------------------------------
|
||||
*
|
||||
* parse_func.h
|
||||
*
|
||||
*
|
||||
*
|
||||
* Portions Copyright (c) 1996-2021, PostgreSQL Global Development Group
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* src/include/parser/parse_func.h
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
#ifndef PARSE_FUNC_H
|
||||
#define PARSE_FUNC_H
|
||||
|
||||
#include "catalog/namespace.h"
|
||||
#include "parser/parse_node.h"
|
||||
|
||||
|
||||
/* Result codes for func_get_detail */
|
||||
typedef enum
|
||||
{
|
||||
FUNCDETAIL_NOTFOUND, /* no matching function */
|
||||
FUNCDETAIL_MULTIPLE, /* too many matching functions */
|
||||
FUNCDETAIL_NORMAL, /* found a matching regular function */
|
||||
FUNCDETAIL_PROCEDURE, /* found a matching procedure */
|
||||
FUNCDETAIL_AGGREGATE, /* found a matching aggregate function */
|
||||
FUNCDETAIL_WINDOWFUNC, /* found a matching window function */
|
||||
FUNCDETAIL_COERCION /* it's a type coercion request */
|
||||
} FuncDetailCode;
|
||||
|
||||
|
||||
extern Node *ParseFuncOrColumn(ParseState *pstate, List *funcname, List *fargs,
|
||||
Node *last_srf, FuncCall *fn, bool proc_call,
|
||||
int location);
|
||||
|
||||
extern FuncDetailCode func_get_detail(List *funcname,
|
||||
List *fargs, List *fargnames,
|
||||
int nargs, Oid *argtypes,
|
||||
bool expand_variadic, bool expand_defaults,
|
||||
bool include_out_arguments,
|
||||
Oid *funcid, Oid *rettype,
|
||||
bool *retset, int *nvargs, Oid *vatype,
|
||||
Oid **true_typeids, List **argdefaults);
|
||||
|
||||
extern int func_match_argtypes(int nargs,
|
||||
Oid *input_typeids,
|
||||
FuncCandidateList raw_candidates,
|
||||
FuncCandidateList *candidates);
|
||||
|
||||
extern FuncCandidateList func_select_candidate(int nargs,
|
||||
Oid *input_typeids,
|
||||
FuncCandidateList candidates);
|
||||
|
||||
extern void make_fn_arguments(ParseState *pstate,
|
||||
List *fargs,
|
||||
Oid *actual_arg_types,
|
||||
Oid *declared_arg_types);
|
||||
|
||||
extern const char *funcname_signature_string(const char *funcname, int nargs,
|
||||
List *argnames, const Oid *argtypes);
|
||||
extern const char *func_signature_string(List *funcname, int nargs,
|
||||
List *argnames, const Oid *argtypes);
|
||||
|
||||
extern Oid LookupFuncName(List *funcname, int nargs, const Oid *argtypes,
|
||||
bool missing_ok);
|
||||
extern Oid LookupFuncWithArgs(ObjectType objtype, ObjectWithArgs *func,
|
||||
bool missing_ok);
|
||||
|
||||
extern void check_srf_call_placement(ParseState *pstate, Node *last_srf,
|
||||
int location);
|
||||
|
||||
#endif /* PARSE_FUNC_H */
|
||||
339
db_include/parser/parse_node.h
Executable file
339
db_include/parser/parse_node.h
Executable file
@@ -0,0 +1,339 @@
|
||||
/*-------------------------------------------------------------------------
|
||||
*
|
||||
* parse_node.h
|
||||
* Internal definitions for parser
|
||||
*
|
||||
*
|
||||
* Portions Copyright (c) 1996-2021, PostgreSQL Global Development Group
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* src/include/parser/parse_node.h
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
#ifndef PARSE_NODE_H
|
||||
#define PARSE_NODE_H
|
||||
|
||||
#include "nodes/parsenodes.h"
|
||||
#include "utils/queryenvironment.h"
|
||||
#include "utils/relcache.h"
|
||||
|
||||
|
||||
/* Forward references for some structs declared below */
|
||||
typedef struct ParseState ParseState;
|
||||
typedef struct ParseNamespaceItem ParseNamespaceItem;
|
||||
typedef struct ParseNamespaceColumn ParseNamespaceColumn;
|
||||
|
||||
/*
|
||||
* Expression kinds distinguished by transformExpr(). Many of these are not
|
||||
* semantically distinct so far as expression transformation goes; rather,
|
||||
* we distinguish them so that context-specific error messages can be printed.
|
||||
*
|
||||
* Note: EXPR_KIND_OTHER is not used in the core code, but is left for use
|
||||
* by extension code that might need to call transformExpr(). The core code
|
||||
* will not enforce any context-driven restrictions on EXPR_KIND_OTHER
|
||||
* expressions, so the caller would have to check for sub-selects, aggregates,
|
||||
* window functions, SRFs, etc if those need to be disallowed.
|
||||
*/
|
||||
typedef enum ParseExprKind
|
||||
{
|
||||
EXPR_KIND_NONE = 0, /* "not in an expression" */
|
||||
EXPR_KIND_OTHER, /* reserved for extensions */
|
||||
EXPR_KIND_JOIN_ON, /* JOIN ON */
|
||||
EXPR_KIND_JOIN_USING, /* JOIN USING */
|
||||
EXPR_KIND_FROM_SUBSELECT, /* sub-SELECT in FROM clause */
|
||||
EXPR_KIND_FROM_FUNCTION, /* function in FROM clause */
|
||||
EXPR_KIND_WHERE, /* WHERE */
|
||||
EXPR_KIND_HAVING, /* HAVING */
|
||||
EXPR_KIND_FILTER, /* FILTER */
|
||||
EXPR_KIND_WINDOW_PARTITION, /* window definition PARTITION BY */
|
||||
EXPR_KIND_WINDOW_ORDER, /* window definition ORDER BY */
|
||||
EXPR_KIND_WINDOW_FRAME_RANGE, /* window frame clause with RANGE */
|
||||
EXPR_KIND_WINDOW_FRAME_ROWS, /* window frame clause with ROWS */
|
||||
EXPR_KIND_WINDOW_FRAME_GROUPS, /* window frame clause with GROUPS */
|
||||
EXPR_KIND_SELECT_TARGET, /* SELECT target list item */
|
||||
EXPR_KIND_INSERT_TARGET, /* INSERT target list item */
|
||||
EXPR_KIND_UPDATE_SOURCE, /* UPDATE assignment source item */
|
||||
EXPR_KIND_UPDATE_TARGET, /* UPDATE assignment target item */
|
||||
EXPR_KIND_GROUP_BY, /* GROUP BY */
|
||||
EXPR_KIND_ORDER_BY, /* ORDER BY */
|
||||
EXPR_KIND_DISTINCT_ON, /* DISTINCT ON */
|
||||
EXPR_KIND_LIMIT, /* LIMIT */
|
||||
EXPR_KIND_OFFSET, /* OFFSET */
|
||||
EXPR_KIND_RETURNING, /* RETURNING */
|
||||
EXPR_KIND_VALUES, /* VALUES */
|
||||
EXPR_KIND_VALUES_SINGLE, /* single-row VALUES (in INSERT only) */
|
||||
EXPR_KIND_CHECK_CONSTRAINT, /* CHECK constraint for a table */
|
||||
EXPR_KIND_DOMAIN_CHECK, /* CHECK constraint for a domain */
|
||||
EXPR_KIND_COLUMN_DEFAULT, /* default value for a table column */
|
||||
EXPR_KIND_FUNCTION_DEFAULT, /* default parameter value for function */
|
||||
EXPR_KIND_INDEX_EXPRESSION, /* index expression */
|
||||
EXPR_KIND_INDEX_PREDICATE, /* index predicate */
|
||||
EXPR_KIND_STATS_EXPRESSION, /* extended statistics expression */
|
||||
EXPR_KIND_ALTER_COL_TRANSFORM, /* transform expr in ALTER COLUMN TYPE */
|
||||
EXPR_KIND_EXECUTE_PARAMETER, /* parameter value in EXECUTE */
|
||||
EXPR_KIND_TRIGGER_WHEN, /* WHEN condition in CREATE TRIGGER */
|
||||
EXPR_KIND_POLICY, /* USING or WITH CHECK expr in policy */
|
||||
EXPR_KIND_PARTITION_BOUND, /* partition bound expression */
|
||||
EXPR_KIND_PARTITION_EXPRESSION, /* PARTITION BY expression */
|
||||
EXPR_KIND_CALL_ARGUMENT, /* procedure argument in CALL */
|
||||
EXPR_KIND_COPY_WHERE, /* WHERE condition in COPY FROM */
|
||||
EXPR_KIND_GENERATED_COLUMN, /* generation expression for a column */
|
||||
EXPR_KIND_CYCLE_MARK, /* cycle mark value */
|
||||
} ParseExprKind;
|
||||
|
||||
|
||||
/*
|
||||
* Function signatures for parser hooks
|
||||
*/
|
||||
typedef Node *(*PreParseColumnRefHook) (ParseState *pstate, ColumnRef *cref);
|
||||
typedef Node *(*PostParseColumnRefHook) (ParseState *pstate, ColumnRef *cref, Node *var);
|
||||
typedef Node *(*ParseParamRefHook) (ParseState *pstate, ParamRef *pref);
|
||||
typedef Node *(*CoerceParamHook) (ParseState *pstate, Param *param,
|
||||
Oid targetTypeId, int32 targetTypeMod,
|
||||
int location);
|
||||
|
||||
|
||||
/*
|
||||
* State information used during parse analysis
|
||||
*
|
||||
* parentParseState: NULL in a top-level ParseState. When parsing a subquery,
|
||||
* links to current parse state of outer query.
|
||||
*
|
||||
* p_sourcetext: source string that generated the raw parsetree being
|
||||
* analyzed, or NULL if not available. (The string is used only to
|
||||
* generate cursor positions in error messages: we need it to convert
|
||||
* byte-wise locations in parse structures to character-wise cursor
|
||||
* positions.)
|
||||
*
|
||||
* p_rtable: list of RTEs that will become the rangetable of the query.
|
||||
* Note that neither relname nor refname of these entries are necessarily
|
||||
* unique; searching the rtable by name is a bad idea.
|
||||
*
|
||||
* p_joinexprs: list of JoinExpr nodes associated with p_rtable entries.
|
||||
* This is one-for-one with p_rtable, but contains NULLs for non-join
|
||||
* RTEs, and may be shorter than p_rtable if the last RTE(s) aren't joins.
|
||||
*
|
||||
* p_joinlist: list of join items (RangeTblRef and JoinExpr nodes) that
|
||||
* will become the fromlist of the query's top-level FromExpr node.
|
||||
*
|
||||
* p_namespace: list of ParseNamespaceItems that represents the current
|
||||
* namespace for table and column lookup. (The RTEs listed here may be just
|
||||
* a subset of the whole rtable. See ParseNamespaceItem comments below.)
|
||||
*
|
||||
* p_lateral_active: true if we are currently parsing a LATERAL subexpression
|
||||
* of this parse level. This makes p_lateral_only namespace items visible,
|
||||
* whereas they are not visible when p_lateral_active is FALSE.
|
||||
*
|
||||
* p_ctenamespace: list of CommonTableExprs (WITH items) that are visible
|
||||
* at the moment. This is entirely different from p_namespace because a CTE
|
||||
* is not an RTE, rather "visibility" means you could make an RTE from it.
|
||||
*
|
||||
* p_future_ctes: list of CommonTableExprs (WITH items) that are not yet
|
||||
* visible due to scope rules. This is used to help improve error messages.
|
||||
*
|
||||
* p_parent_cte: CommonTableExpr that immediately contains the current query,
|
||||
* if any.
|
||||
*
|
||||
* p_target_relation: target relation, if query is INSERT, UPDATE, or DELETE.
|
||||
*
|
||||
* p_target_nsitem: target relation's ParseNamespaceItem.
|
||||
*
|
||||
* p_is_insert: true to process assignment expressions like INSERT, false
|
||||
* to process them like UPDATE. (Note this can change intra-statement, for
|
||||
* cases like INSERT ON CONFLICT UPDATE.)
|
||||
*
|
||||
* p_windowdefs: list of WindowDefs representing WINDOW and OVER clauses.
|
||||
* We collect these while transforming expressions and then transform them
|
||||
* afterwards (so that any resjunk tlist items needed for the sort/group
|
||||
* clauses end up at the end of the query tlist). A WindowDef's location in
|
||||
* this list, counting from 1, is the winref number to use to reference it.
|
||||
*
|
||||
* p_expr_kind: kind of expression we're currently parsing, as per enum above;
|
||||
* EXPR_KIND_NONE when not in an expression.
|
||||
*
|
||||
* p_next_resno: next TargetEntry.resno to assign, starting from 1.
|
||||
*
|
||||
* p_multiassign_exprs: partially-processed MultiAssignRef source expressions.
|
||||
*
|
||||
* p_locking_clause: query's FOR UPDATE/FOR SHARE clause, if any.
|
||||
*
|
||||
* p_locked_from_parent: true if parent query level applies FOR UPDATE/SHARE
|
||||
* to this subquery as a whole.
|
||||
*
|
||||
* p_resolve_unknowns: resolve unknown-type SELECT output columns as type TEXT
|
||||
* (this is true by default).
|
||||
*
|
||||
* p_hasAggs, p_hasWindowFuncs, etc: true if we've found any of the indicated
|
||||
* constructs in the query.
|
||||
*
|
||||
* p_last_srf: the set-returning FuncExpr or OpExpr most recently found in
|
||||
* the query, or NULL if none.
|
||||
*
|
||||
* p_pre_columnref_hook, etc: optional parser hook functions for modifying the
|
||||
* interpretation of ColumnRefs and ParamRefs.
|
||||
*
|
||||
* p_ref_hook_state: passthrough state for the parser hook functions.
|
||||
*/
|
||||
struct ParseState
|
||||
{
|
||||
ParseState *parentParseState; /* stack link */
|
||||
const char *p_sourcetext; /* source text, or NULL if not available */
|
||||
List *p_rtable; /* range table so far */
|
||||
List *p_joinexprs; /* JoinExprs for RTE_JOIN p_rtable entries */
|
||||
List *p_joinlist; /* join items so far (will become FromExpr
|
||||
* node's fromlist) */
|
||||
List *p_namespace; /* currently-referenceable RTEs (List of
|
||||
* ParseNamespaceItem) */
|
||||
bool p_lateral_active; /* p_lateral_only items visible? */
|
||||
List *p_ctenamespace; /* current namespace for common table exprs */
|
||||
List *p_future_ctes; /* common table exprs not yet in namespace */
|
||||
CommonTableExpr *p_parent_cte; /* this query's containing CTE */
|
||||
Relation p_target_relation; /* INSERT/UPDATE/DELETE target rel */
|
||||
ParseNamespaceItem *p_target_nsitem; /* target rel's NSItem, or NULL */
|
||||
bool p_is_insert; /* process assignment like INSERT not UPDATE */
|
||||
List *p_windowdefs; /* raw representations of window clauses */
|
||||
ParseExprKind p_expr_kind; /* what kind of expression we're parsing */
|
||||
int p_next_resno; /* next targetlist resno to assign */
|
||||
List *p_multiassign_exprs; /* junk tlist entries for multiassign */
|
||||
List *p_locking_clause; /* raw FOR UPDATE/FOR SHARE info */
|
||||
bool p_locked_from_parent; /* parent has marked this subquery
|
||||
* with FOR UPDATE/FOR SHARE */
|
||||
bool p_resolve_unknowns; /* resolve unknown-type SELECT outputs as
|
||||
* type text */
|
||||
|
||||
QueryEnvironment *p_queryEnv; /* curr env, incl refs to enclosing env */
|
||||
|
||||
/* Flags telling about things found in the query: */
|
||||
bool p_hasAggs;
|
||||
bool p_hasWindowFuncs;
|
||||
bool p_hasTargetSRFs;
|
||||
bool p_hasSubLinks;
|
||||
bool p_hasModifyingCTE;
|
||||
|
||||
Node *p_last_srf; /* most recent set-returning func/op found */
|
||||
|
||||
/*
|
||||
* Optional hook functions for parser callbacks. These are null unless
|
||||
* set up by the caller of make_parsestate.
|
||||
*/
|
||||
PreParseColumnRefHook p_pre_columnref_hook;
|
||||
PostParseColumnRefHook p_post_columnref_hook;
|
||||
ParseParamRefHook p_paramref_hook;
|
||||
CoerceParamHook p_coerce_param_hook;
|
||||
void *p_ref_hook_state; /* common passthrough link for above */
|
||||
};
|
||||
|
||||
/*
|
||||
* An element of a namespace list.
|
||||
*
|
||||
* p_names contains the table name and column names exposed by this nsitem.
|
||||
* (Typically it's equal to p_rte->eref, but for a JOIN USING alias it's
|
||||
* equal to p_rte->join_using_alias. Since the USING columns will be the
|
||||
* join's first N columns, the net effect is just that we expose only those
|
||||
* join columns via this nsitem.)
|
||||
*
|
||||
* p_rte and p_rtindex link to the underlying rangetable entry.
|
||||
*
|
||||
* The p_nscolumns array contains info showing how to construct Vars
|
||||
* referencing the names appearing in the p_names->colnames list.
|
||||
*
|
||||
* Namespace items with p_rel_visible set define which RTEs are accessible by
|
||||
* qualified names, while those with p_cols_visible set define which RTEs are
|
||||
* accessible by unqualified names. These sets are different because a JOIN
|
||||
* without an alias does not hide the contained tables (so they must be
|
||||
* visible for qualified references) but it does hide their columns
|
||||
* (unqualified references to the columns refer to the JOIN, not the member
|
||||
* tables, so we must not complain that such a reference is ambiguous).
|
||||
* Various special RTEs such as NEW/OLD for rules may also appear with only
|
||||
* one flag set.
|
||||
*
|
||||
* While processing the FROM clause, namespace items may appear with
|
||||
* p_lateral_only set, meaning they are visible only to LATERAL
|
||||
* subexpressions. (The pstate's p_lateral_active flag tells whether we are
|
||||
* inside such a subexpression at the moment.) If p_lateral_ok is not set,
|
||||
* it's an error to actually use such a namespace item. One might think it
|
||||
* would be better to just exclude such items from visibility, but the wording
|
||||
* of SQL:2008 requires us to do it this way. We also use p_lateral_ok to
|
||||
* forbid LATERAL references to an UPDATE/DELETE target table.
|
||||
*
|
||||
* At no time should a namespace list contain two entries that conflict
|
||||
* according to the rules in checkNameSpaceConflicts; but note that those
|
||||
* are more complicated than "must have different alias names", so in practice
|
||||
* code searching a namespace list has to check for ambiguous references.
|
||||
*/
|
||||
struct ParseNamespaceItem
|
||||
{
|
||||
Alias *p_names; /* Table and column names */
|
||||
RangeTblEntry *p_rte; /* The relation's rangetable entry */
|
||||
int p_rtindex; /* The relation's index in the rangetable */
|
||||
/* array of same length as p_names->colnames: */
|
||||
ParseNamespaceColumn *p_nscolumns; /* per-column data */
|
||||
bool p_rel_visible; /* Relation name is visible? */
|
||||
bool p_cols_visible; /* Column names visible as unqualified refs? */
|
||||
bool p_lateral_only; /* Is only visible to LATERAL expressions? */
|
||||
bool p_lateral_ok; /* If so, does join type allow use? */
|
||||
};
|
||||
|
||||
/*
|
||||
* Data about one column of a ParseNamespaceItem.
|
||||
*
|
||||
* We track the info needed to construct a Var referencing the column
|
||||
* (but only for user-defined columns; system column references and
|
||||
* whole-row references are handled separately).
|
||||
*
|
||||
* p_varno and p_varattno identify the semantic referent, which is a
|
||||
* base-relation column unless the reference is to a join USING column that
|
||||
* isn't semantically equivalent to either join input column (because it is a
|
||||
* FULL join or the input column requires a type coercion). In those cases
|
||||
* p_varno and p_varattno refer to the JOIN RTE.
|
||||
*
|
||||
* p_varnosyn and p_varattnosyn are either identical to p_varno/p_varattno,
|
||||
* or they specify the column's position in an aliased JOIN RTE that hides
|
||||
* the semantic referent RTE's refname. (That could be either the JOIN RTE
|
||||
* in which this ParseNamespaceColumn entry exists, or some lower join level.)
|
||||
*
|
||||
* If an RTE contains a dropped column, its ParseNamespaceColumn struct
|
||||
* is all-zeroes. (Conventionally, test for p_varno == 0 to detect this.)
|
||||
*/
|
||||
struct ParseNamespaceColumn
|
||||
{
|
||||
Index p_varno; /* rangetable index */
|
||||
AttrNumber p_varattno; /* attribute number of the column */
|
||||
Oid p_vartype; /* pg_type OID */
|
||||
int32 p_vartypmod; /* type modifier value */
|
||||
Oid p_varcollid; /* OID of collation, or InvalidOid */
|
||||
Index p_varnosyn; /* rangetable index of syntactic referent */
|
||||
AttrNumber p_varattnosyn; /* attribute number of syntactic referent */
|
||||
bool p_dontexpand; /* not included in star expansion */
|
||||
};
|
||||
|
||||
/* Support for parser_errposition_callback function */
|
||||
typedef struct ParseCallbackState
|
||||
{
|
||||
ParseState *pstate;
|
||||
int location;
|
||||
ErrorContextCallback errcallback;
|
||||
} ParseCallbackState;
|
||||
|
||||
|
||||
extern ParseState *make_parsestate(ParseState *parentParseState);
|
||||
extern void free_parsestate(ParseState *pstate);
|
||||
extern int parser_errposition(ParseState *pstate, int location);
|
||||
|
||||
extern void setup_parser_errposition_callback(ParseCallbackState *pcbstate,
|
||||
ParseState *pstate, int location);
|
||||
extern void cancel_parser_errposition_callback(ParseCallbackState *pcbstate);
|
||||
|
||||
extern void transformContainerType(Oid *containerType, int32 *containerTypmod);
|
||||
|
||||
extern SubscriptingRef *transformContainerSubscripts(ParseState *pstate,
|
||||
Node *containerBase,
|
||||
Oid containerType,
|
||||
int32 containerTypMod,
|
||||
List *indirection,
|
||||
bool isAssignment);
|
||||
|
||||
extern Const *make_const(ParseState *pstate, Value *value, int location);
|
||||
|
||||
#endif /* PARSE_NODE_H */
|
||||
65
db_include/parser/parse_oper.h
Executable file
65
db_include/parser/parse_oper.h
Executable file
@@ -0,0 +1,65 @@
|
||||
/*-------------------------------------------------------------------------
|
||||
*
|
||||
* parse_oper.h
|
||||
* handle operator things for parser
|
||||
*
|
||||
*
|
||||
* Portions Copyright (c) 1996-2021, PostgreSQL Global Development Group
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* src/include/parser/parse_oper.h
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
#ifndef PARSE_OPER_H
|
||||
#define PARSE_OPER_H
|
||||
|
||||
#include "access/htup.h"
|
||||
#include "nodes/parsenodes.h"
|
||||
#include "parser/parse_node.h"
|
||||
|
||||
|
||||
typedef HeapTuple Operator;
|
||||
|
||||
/* Routines to look up an operator given name and exact input type(s) */
|
||||
extern Oid LookupOperName(ParseState *pstate, List *opername,
|
||||
Oid oprleft, Oid oprright,
|
||||
bool noError, int location);
|
||||
extern Oid LookupOperWithArgs(ObjectWithArgs *oper, bool noError);
|
||||
|
||||
/* Routines to find operators matching a name and given input types */
|
||||
/* NB: the selected operator may require coercion of the input types! */
|
||||
extern Operator oper(ParseState *pstate, List *op, Oid arg1, Oid arg2,
|
||||
bool noError, int location);
|
||||
extern Operator left_oper(ParseState *pstate, List *op, Oid arg,
|
||||
bool noError, int location);
|
||||
|
||||
/* Routines to find operators that DO NOT require coercion --- ie, their */
|
||||
/* input types are either exactly as given, or binary-compatible */
|
||||
extern Operator compatible_oper(ParseState *pstate, List *op,
|
||||
Oid arg1, Oid arg2,
|
||||
bool noError, int location);
|
||||
|
||||
/* currently no need for compatible_left_oper/compatible_right_oper */
|
||||
|
||||
/* Routines for identifying "<", "=", ">" operators for a type */
|
||||
extern void get_sort_group_operators(Oid argtype,
|
||||
bool needLT, bool needEQ, bool needGT,
|
||||
Oid *ltOpr, Oid *eqOpr, Oid *gtOpr,
|
||||
bool *isHashable);
|
||||
|
||||
/* Convenience routines for common calls on the above */
|
||||
extern Oid compatible_oper_opid(List *op, Oid arg1, Oid arg2, bool noError);
|
||||
|
||||
/* Extract operator OID or underlying-function OID from an Operator tuple */
|
||||
extern Oid oprid(Operator op);
|
||||
extern Oid oprfuncid(Operator op);
|
||||
|
||||
/* Build expression tree for an operator invocation */
|
||||
extern Expr *make_op(ParseState *pstate, List *opname,
|
||||
Node *ltree, Node *rtree, Node *last_srf, int location);
|
||||
extern Expr *make_scalar_array_op(ParseState *pstate, List *opname,
|
||||
bool useOr,
|
||||
Node *ltree, Node *rtree, int location);
|
||||
|
||||
#endif /* PARSE_OPER_H */
|
||||
25
db_include/parser/parse_param.h
Executable file
25
db_include/parser/parse_param.h
Executable file
@@ -0,0 +1,25 @@
|
||||
/*-------------------------------------------------------------------------
|
||||
*
|
||||
* parse_param.h
|
||||
* handle parameters in parser
|
||||
*
|
||||
* Portions Copyright (c) 1996-2021, PostgreSQL Global Development Group
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* src/include/parser/parse_param.h
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
#ifndef PARSE_PARAM_H
|
||||
#define PARSE_PARAM_H
|
||||
|
||||
#include "parser/parse_node.h"
|
||||
|
||||
extern void parse_fixed_parameters(ParseState *pstate,
|
||||
Oid *paramTypes, int numParams);
|
||||
extern void parse_variable_parameters(ParseState *pstate,
|
||||
Oid **paramTypes, int *numParams);
|
||||
extern void check_variable_parameters(ParseState *pstate, Query *query);
|
||||
extern bool query_contains_extern_params(Query *query);
|
||||
|
||||
#endif /* PARSE_PARAM_H */
|
||||
123
db_include/parser/parse_relation.h
Executable file
123
db_include/parser/parse_relation.h
Executable file
@@ -0,0 +1,123 @@
|
||||
/*-------------------------------------------------------------------------
|
||||
*
|
||||
* parse_relation.h
|
||||
* prototypes for parse_relation.c.
|
||||
*
|
||||
*
|
||||
* Portions Copyright (c) 1996-2021, PostgreSQL Global Development Group
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* src/include/parser/parse_relation.h
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
#ifndef PARSE_RELATION_H
|
||||
#define PARSE_RELATION_H
|
||||
|
||||
#include "parser/parse_node.h"
|
||||
|
||||
|
||||
extern ParseNamespaceItem *refnameNamespaceItem(ParseState *pstate,
|
||||
const char *schemaname,
|
||||
const char *refname,
|
||||
int location,
|
||||
int *sublevels_up);
|
||||
extern CommonTableExpr *scanNameSpaceForCTE(ParseState *pstate,
|
||||
const char *refname,
|
||||
Index *ctelevelsup);
|
||||
extern bool scanNameSpaceForENR(ParseState *pstate, const char *refname);
|
||||
extern void checkNameSpaceConflicts(ParseState *pstate, List *namespace1,
|
||||
List *namespace2);
|
||||
extern ParseNamespaceItem *GetNSItemByRangeTablePosn(ParseState *pstate,
|
||||
int varno,
|
||||
int sublevels_up);
|
||||
extern RangeTblEntry *GetRTEByRangeTablePosn(ParseState *pstate,
|
||||
int varno,
|
||||
int sublevels_up);
|
||||
extern CommonTableExpr *GetCTEForRTE(ParseState *pstate, RangeTblEntry *rte,
|
||||
int rtelevelsup);
|
||||
extern Node *scanNSItemForColumn(ParseState *pstate, ParseNamespaceItem *nsitem,
|
||||
int sublevels_up, const char *colname,
|
||||
int location);
|
||||
extern Node *colNameToVar(ParseState *pstate, const char *colname, bool localonly,
|
||||
int location);
|
||||
extern void markVarForSelectPriv(ParseState *pstate, Var *var);
|
||||
extern Relation parserOpenTable(ParseState *pstate, const RangeVar *relation,
|
||||
int lockmode);
|
||||
extern ParseNamespaceItem *addRangeTableEntry(ParseState *pstate,
|
||||
RangeVar *relation,
|
||||
Alias *alias,
|
||||
bool inh,
|
||||
bool inFromCl);
|
||||
extern ParseNamespaceItem *addRangeTableEntryForRelation(ParseState *pstate,
|
||||
Relation rel,
|
||||
int lockmode,
|
||||
Alias *alias,
|
||||
bool inh,
|
||||
bool inFromCl);
|
||||
extern ParseNamespaceItem *addRangeTableEntryForSubquery(ParseState *pstate,
|
||||
Query *subquery,
|
||||
Alias *alias,
|
||||
bool lateral,
|
||||
bool inFromCl);
|
||||
extern ParseNamespaceItem *addRangeTableEntryForFunction(ParseState *pstate,
|
||||
List *funcnames,
|
||||
List *funcexprs,
|
||||
List *coldeflists,
|
||||
RangeFunction *rangefunc,
|
||||
bool lateral,
|
||||
bool inFromCl);
|
||||
extern ParseNamespaceItem *addRangeTableEntryForValues(ParseState *pstate,
|
||||
List *exprs,
|
||||
List *coltypes,
|
||||
List *coltypmods,
|
||||
List *colcollations,
|
||||
Alias *alias,
|
||||
bool lateral,
|
||||
bool inFromCl);
|
||||
extern ParseNamespaceItem *addRangeTableEntryForTableFunc(ParseState *pstate,
|
||||
TableFunc *tf,
|
||||
Alias *alias,
|
||||
bool lateral,
|
||||
bool inFromCl);
|
||||
extern ParseNamespaceItem *addRangeTableEntryForJoin(ParseState *pstate,
|
||||
List *colnames,
|
||||
ParseNamespaceColumn *nscolumns,
|
||||
JoinType jointype,
|
||||
int nummergedcols,
|
||||
List *aliasvars,
|
||||
List *leftcols,
|
||||
List *rightcols,
|
||||
Alias *joinalias,
|
||||
Alias *alias,
|
||||
bool inFromCl);
|
||||
extern ParseNamespaceItem *addRangeTableEntryForCTE(ParseState *pstate,
|
||||
CommonTableExpr *cte,
|
||||
Index levelsup,
|
||||
RangeVar *rv,
|
||||
bool inFromCl);
|
||||
extern ParseNamespaceItem *addRangeTableEntryForENR(ParseState *pstate,
|
||||
RangeVar *rv,
|
||||
bool inFromCl);
|
||||
extern bool isLockedRefname(ParseState *pstate, const char *refname);
|
||||
extern void addNSItemToQuery(ParseState *pstate, ParseNamespaceItem *nsitem,
|
||||
bool addToJoinList,
|
||||
bool addToRelNameSpace, bool addToVarNameSpace);
|
||||
extern void errorMissingRTE(ParseState *pstate, RangeVar *relation) pg_attribute_noreturn();
|
||||
extern void errorMissingColumn(ParseState *pstate,
|
||||
const char *relname, const char *colname, int location) pg_attribute_noreturn();
|
||||
extern void expandRTE(RangeTblEntry *rte, int rtindex, int sublevels_up,
|
||||
int location, bool include_dropped,
|
||||
List **colnames, List **colvars);
|
||||
extern List *expandNSItemVars(ParseNamespaceItem *nsitem,
|
||||
int sublevels_up, int location,
|
||||
List **colnames);
|
||||
extern List *expandNSItemAttrs(ParseState *pstate, ParseNamespaceItem *nsitem,
|
||||
int sublevels_up, int location);
|
||||
extern int attnameAttNum(Relation rd, const char *attname, bool sysColOK);
|
||||
extern const NameData *attnumAttName(Relation rd, int attid);
|
||||
extern Oid attnumTypeId(Relation rd, int attid);
|
||||
extern Oid attnumCollationId(Relation rd, int attid);
|
||||
extern bool isQueryUsingTempRelation(Query *query);
|
||||
|
||||
#endif /* PARSE_RELATION_H */
|
||||
58
db_include/parser/parse_target.h
Executable file
58
db_include/parser/parse_target.h
Executable file
@@ -0,0 +1,58 @@
|
||||
/*-------------------------------------------------------------------------
|
||||
*
|
||||
* parse_target.h
|
||||
* handle target lists
|
||||
*
|
||||
*
|
||||
* Portions Copyright (c) 1996-2021, PostgreSQL Global Development Group
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* src/include/parser/parse_target.h
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
#ifndef PARSE_TARGET_H
|
||||
#define PARSE_TARGET_H
|
||||
|
||||
#include "parser/parse_node.h"
|
||||
|
||||
|
||||
extern List *transformTargetList(ParseState *pstate, List *targetlist,
|
||||
ParseExprKind exprKind);
|
||||
extern List *transformExpressionList(ParseState *pstate, List *exprlist,
|
||||
ParseExprKind exprKind, bool allowDefault);
|
||||
extern void resolveTargetListUnknowns(ParseState *pstate, List *targetlist);
|
||||
extern void markTargetListOrigins(ParseState *pstate, List *targetlist);
|
||||
extern TargetEntry *transformTargetEntry(ParseState *pstate,
|
||||
Node *node, Node *expr, ParseExprKind exprKind,
|
||||
char *colname, bool resjunk);
|
||||
extern Expr *transformAssignedExpr(ParseState *pstate, Expr *expr,
|
||||
ParseExprKind exprKind,
|
||||
const char *colname,
|
||||
int attrno,
|
||||
List *indirection,
|
||||
int location);
|
||||
extern void updateTargetListEntry(ParseState *pstate, TargetEntry *tle,
|
||||
char *colname, int attrno,
|
||||
List *indirection,
|
||||
int location);
|
||||
extern Node *transformAssignmentIndirection(ParseState *pstate,
|
||||
Node *basenode,
|
||||
const char *targetName,
|
||||
bool targetIsSubscripting,
|
||||
Oid targetTypeId,
|
||||
int32 targetTypMod,
|
||||
Oid targetCollation,
|
||||
List *indirection,
|
||||
ListCell *indirection_cell,
|
||||
Node *rhs,
|
||||
CoercionContext ccontext,
|
||||
int location);
|
||||
extern List *checkInsertTargets(ParseState *pstate, List *cols,
|
||||
List **attrnos);
|
||||
extern TupleDesc expandRecordVariable(ParseState *pstate, Var *var,
|
||||
int levelsup);
|
||||
extern char *FigureColname(Node *node);
|
||||
extern char *FigureIndexColname(Node *node);
|
||||
|
||||
#endif /* PARSE_TARGET_H */
|
||||
60
db_include/parser/parse_type.h
Executable file
60
db_include/parser/parse_type.h
Executable file
@@ -0,0 +1,60 @@
|
||||
/*-------------------------------------------------------------------------
|
||||
*
|
||||
* parse_type.h
|
||||
* handle type operations for parser
|
||||
*
|
||||
* Portions Copyright (c) 1996-2021, PostgreSQL Global Development Group
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* src/include/parser/parse_type.h
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
#ifndef PARSE_TYPE_H
|
||||
#define PARSE_TYPE_H
|
||||
|
||||
#include "access/htup.h"
|
||||
#include "parser/parse_node.h"
|
||||
|
||||
|
||||
typedef HeapTuple Type;
|
||||
|
||||
extern Type LookupTypeName(ParseState *pstate, const TypeName *typeName,
|
||||
int32 *typmod_p, bool missing_ok);
|
||||
extern Type LookupTypeNameExtended(ParseState *pstate,
|
||||
const TypeName *typeName, int32 *typmod_p,
|
||||
bool temp_ok, bool missing_ok);
|
||||
extern Oid LookupTypeNameOid(ParseState *pstate, const TypeName *typeName,
|
||||
bool missing_ok);
|
||||
extern Type typenameType(ParseState *pstate, const TypeName *typeName,
|
||||
int32 *typmod_p);
|
||||
extern Oid typenameTypeId(ParseState *pstate, const TypeName *typeName);
|
||||
extern void typenameTypeIdAndMod(ParseState *pstate, const TypeName *typeName,
|
||||
Oid *typeid_p, int32 *typmod_p);
|
||||
|
||||
extern char *TypeNameToString(const TypeName *typeName);
|
||||
extern char *TypeNameListToString(List *typenames);
|
||||
|
||||
extern Oid LookupCollation(ParseState *pstate, List *collnames, int location);
|
||||
extern Oid GetColumnDefCollation(ParseState *pstate, ColumnDef *coldef, Oid typeOid);
|
||||
|
||||
extern Type typeidType(Oid id);
|
||||
|
||||
extern Oid typeTypeId(Type tp);
|
||||
extern int16 typeLen(Type t);
|
||||
extern bool typeByVal(Type t);
|
||||
extern char *typeTypeName(Type t);
|
||||
extern Oid typeTypeRelid(Type typ);
|
||||
extern Oid typeTypeCollation(Type typ);
|
||||
extern Datum stringTypeDatum(Type tp, char *string, int32 atttypmod);
|
||||
|
||||
extern Oid typeidTypeRelid(Oid type_id);
|
||||
extern Oid typeOrDomainTypeRelid(Oid type_id);
|
||||
|
||||
extern TypeName *typeStringToTypeName(const char *str);
|
||||
extern void parseTypeString(const char *str, Oid *typeid_p, int32 *typmod_p, bool missing_ok);
|
||||
|
||||
/* true if typeid is composite, or domain over composite, but not RECORD */
|
||||
#define ISCOMPLEX(typeid) (typeOrDomainTypeRelid(typeid) != InvalidOid)
|
||||
|
||||
#endif /* PARSE_TYPE_H */
|
||||
43
db_include/parser/parse_utilcmd.h
Executable file
43
db_include/parser/parse_utilcmd.h
Executable file
@@ -0,0 +1,43 @@
|
||||
/*-------------------------------------------------------------------------
|
||||
*
|
||||
* parse_utilcmd.h
|
||||
* parse analysis for utility commands
|
||||
*
|
||||
*
|
||||
* Portions Copyright (c) 1996-2021, PostgreSQL Global Development Group
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* src/include/parser/parse_utilcmd.h
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
#ifndef PARSE_UTILCMD_H
|
||||
#define PARSE_UTILCMD_H
|
||||
|
||||
#include "parser/parse_node.h"
|
||||
|
||||
struct AttrMap; /* avoid including attmap.h here */
|
||||
|
||||
|
||||
extern List *transformCreateStmt(CreateStmt *stmt, const char *queryString);
|
||||
extern AlterTableStmt *transformAlterTableStmt(Oid relid, AlterTableStmt *stmt,
|
||||
const char *queryString,
|
||||
List **beforeStmts,
|
||||
List **afterStmts);
|
||||
extern IndexStmt *transformIndexStmt(Oid relid, IndexStmt *stmt,
|
||||
const char *queryString);
|
||||
extern CreateStatsStmt *transformStatsStmt(Oid relid, CreateStatsStmt *stmt,
|
||||
const char *queryString);
|
||||
extern void transformRuleStmt(RuleStmt *stmt, const char *queryString,
|
||||
List **actions, Node **whereClause);
|
||||
extern List *transformCreateSchemaStmt(CreateSchemaStmt *stmt);
|
||||
extern PartitionBoundSpec *transformPartitionBound(ParseState *pstate, Relation parent,
|
||||
PartitionBoundSpec *spec);
|
||||
extern List *expandTableLikeClause(RangeVar *heapRel,
|
||||
TableLikeClause *table_like_clause);
|
||||
extern IndexStmt *generateClonedIndexStmt(RangeVar *heapRel,
|
||||
Relation source_idx,
|
||||
const struct AttrMap *attmap,
|
||||
Oid *constraintOid);
|
||||
|
||||
#endif /* PARSE_UTILCMD_H */
|
||||
68
db_include/parser/parser.h
Executable file
68
db_include/parser/parser.h
Executable file
@@ -0,0 +1,68 @@
|
||||
/*-------------------------------------------------------------------------
|
||||
*
|
||||
* parser.h
|
||||
* Definitions for the "raw" parser (flex and bison phases only)
|
||||
*
|
||||
* This is the external API for the raw lexing/parsing functions.
|
||||
*
|
||||
* Portions Copyright (c) 1996-2021, PostgreSQL Global Development Group
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* src/include/parser/parser.h
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
#ifndef PARSER_H
|
||||
#define PARSER_H
|
||||
|
||||
#include "nodes/parsenodes.h"
|
||||
|
||||
|
||||
/*
|
||||
* RawParseMode determines the form of the string that raw_parser() accepts:
|
||||
*
|
||||
* RAW_PARSE_DEFAULT: parse a semicolon-separated list of SQL commands,
|
||||
* and return a List of RawStmt nodes.
|
||||
*
|
||||
* RAW_PARSE_TYPE_NAME: parse a type name, and return a one-element List
|
||||
* containing a TypeName node.
|
||||
*
|
||||
* RAW_PARSE_PLPGSQL_EXPR: parse a PL/pgSQL expression, and return
|
||||
* a one-element List containing a RawStmt node.
|
||||
*
|
||||
* RAW_PARSE_PLPGSQL_ASSIGNn: parse a PL/pgSQL assignment statement,
|
||||
* and return a one-element List containing a RawStmt node. "n"
|
||||
* gives the number of dotted names comprising the target ColumnRef.
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
RAW_PARSE_DEFAULT = 0,
|
||||
RAW_PARSE_TYPE_NAME,
|
||||
RAW_PARSE_PLPGSQL_EXPR,
|
||||
RAW_PARSE_PLPGSQL_ASSIGN1,
|
||||
RAW_PARSE_PLPGSQL_ASSIGN2,
|
||||
RAW_PARSE_PLPGSQL_ASSIGN3
|
||||
} RawParseMode;
|
||||
|
||||
/* Values for the backslash_quote GUC */
|
||||
typedef enum
|
||||
{
|
||||
BACKSLASH_QUOTE_OFF,
|
||||
BACKSLASH_QUOTE_ON,
|
||||
BACKSLASH_QUOTE_SAFE_ENCODING
|
||||
} BackslashQuoteType;
|
||||
|
||||
/* GUC variables in scan.l (every one of these is a bad idea :-() */
|
||||
extern int backslash_quote;
|
||||
extern bool escape_string_warning;
|
||||
extern PGDLLIMPORT bool standard_conforming_strings;
|
||||
|
||||
|
||||
/* Primary entry point for the raw parsing functions */
|
||||
extern List *raw_parser(const char *str, RawParseMode mode);
|
||||
|
||||
/* Utility functions exported by gram.y (perhaps these should be elsewhere) */
|
||||
extern List *SystemFuncName(char *name);
|
||||
extern TypeName *SystemTypeName(char *name);
|
||||
|
||||
#endif /* PARSER_H */
|
||||
61
db_include/parser/parsetree.h
Executable file
61
db_include/parser/parsetree.h
Executable file
@@ -0,0 +1,61 @@
|
||||
/*-------------------------------------------------------------------------
|
||||
*
|
||||
* parsetree.h
|
||||
* Routines to access various components and subcomponents of
|
||||
* parse trees.
|
||||
*
|
||||
*
|
||||
* Portions Copyright (c) 1996-2021, PostgreSQL Global Development Group
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* src/include/parser/parsetree.h
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
#ifndef PARSETREE_H
|
||||
#define PARSETREE_H
|
||||
|
||||
#include "nodes/parsenodes.h"
|
||||
|
||||
|
||||
/* ----------------
|
||||
* range table operations
|
||||
* ----------------
|
||||
*/
|
||||
|
||||
/*
|
||||
* rt_fetch
|
||||
*
|
||||
* NB: this will crash and burn if handed an out-of-range RT index
|
||||
*/
|
||||
#define rt_fetch(rangetable_index, rangetable) \
|
||||
((RangeTblEntry *) list_nth(rangetable, (rangetable_index)-1))
|
||||
|
||||
/*
|
||||
* Given an RTE and an attribute number, return the appropriate
|
||||
* variable name or alias for that attribute of that RTE.
|
||||
*/
|
||||
extern char *get_rte_attribute_name(RangeTblEntry *rte, AttrNumber attnum);
|
||||
|
||||
/*
|
||||
* Check whether an attribute of an RTE has been dropped
|
||||
*/
|
||||
extern bool get_rte_attribute_is_dropped(RangeTblEntry *rte,
|
||||
AttrNumber attnum);
|
||||
|
||||
|
||||
/* ----------------
|
||||
* target list operations
|
||||
* ----------------
|
||||
*/
|
||||
|
||||
extern TargetEntry *get_tle_by_resno(List *tlist, AttrNumber resno);
|
||||
|
||||
/* ----------------
|
||||
* FOR UPDATE/SHARE info
|
||||
* ----------------
|
||||
*/
|
||||
|
||||
extern RowMarkClause *get_parse_rowmark(Query *qry, Index rtindex);
|
||||
|
||||
#endif /* PARSETREE_H */
|
||||
150
db_include/parser/scanner.h
Executable file
150
db_include/parser/scanner.h
Executable file
@@ -0,0 +1,150 @@
|
||||
/*-------------------------------------------------------------------------
|
||||
*
|
||||
* scanner.h
|
||||
* API for the core scanner (flex machine)
|
||||
*
|
||||
* The core scanner is also used by PL/pgSQL, so we provide a public API
|
||||
* for it. However, the rest of the backend is only expected to use the
|
||||
* higher-level API provided by parser.h.
|
||||
*
|
||||
*
|
||||
* Portions Copyright (c) 1996-2021, PostgreSQL Global Development Group
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* src/include/parser/scanner.h
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#ifndef SCANNER_H
|
||||
#define SCANNER_H
|
||||
|
||||
#include "common/keywords.h"
|
||||
|
||||
/*
|
||||
* The scanner returns extra data about scanned tokens in this union type.
|
||||
* Note that this is a subset of the fields used in YYSTYPE of the bison
|
||||
* parsers built atop the scanner.
|
||||
*/
|
||||
typedef union core_YYSTYPE
|
||||
{
|
||||
int ival; /* for integer literals */
|
||||
char *str; /* for identifiers and non-integer literals */
|
||||
const char *keyword; /* canonical spelling of keywords */
|
||||
} core_YYSTYPE;
|
||||
|
||||
/*
|
||||
* We track token locations in terms of byte offsets from the start of the
|
||||
* source string, not the column number/line number representation that
|
||||
* bison uses by default. Also, to minimize overhead we track only one
|
||||
* location (usually the first token location) for each construct, not
|
||||
* the beginning and ending locations as bison does by default. It's
|
||||
* therefore sufficient to make YYLTYPE an int.
|
||||
*/
|
||||
#define YYLTYPE int
|
||||
|
||||
/*
|
||||
* Another important component of the scanner's API is the token code numbers.
|
||||
* However, those are not defined in this file, because bison insists on
|
||||
* defining them for itself. The token codes used by the core scanner are
|
||||
* the ASCII characters plus these:
|
||||
* %token <str> IDENT UIDENT FCONST SCONST USCONST BCONST XCONST Op
|
||||
* %token <ival> ICONST PARAM
|
||||
* %token TYPECAST DOT_DOT COLON_EQUALS EQUALS_GREATER
|
||||
* %token LESS_EQUALS GREATER_EQUALS NOT_EQUALS
|
||||
* The above token definitions *must* be the first ones declared in any
|
||||
* bison parser built atop this scanner, so that they will have consistent
|
||||
* numbers assigned to them (specifically, IDENT = 258 and so on).
|
||||
*/
|
||||
|
||||
/*
|
||||
* The YY_EXTRA data that a flex scanner allows us to pass around.
|
||||
* Private state needed by the core scanner goes here. Note that the actual
|
||||
* yy_extra struct may be larger and have this as its first component, thus
|
||||
* allowing the calling parser to keep some fields of its own in YY_EXTRA.
|
||||
*/
|
||||
typedef struct core_yy_extra_type
|
||||
{
|
||||
/*
|
||||
* The string the scanner is physically scanning. We keep this mainly so
|
||||
* that we can cheaply compute the offset of the current token (yytext).
|
||||
*/
|
||||
char *scanbuf;
|
||||
Size scanbuflen;
|
||||
|
||||
/*
|
||||
* The keyword list to use, and the associated grammar token codes.
|
||||
*/
|
||||
const ScanKeywordList *keywordlist;
|
||||
const uint16 *keyword_tokens;
|
||||
|
||||
/*
|
||||
* Scanner settings to use. These are initialized from the corresponding
|
||||
* GUC variables by scanner_init(). Callers can modify them after
|
||||
* scanner_init() if they don't want the scanner's behavior to follow the
|
||||
* prevailing GUC settings.
|
||||
*/
|
||||
int backslash_quote;
|
||||
bool escape_string_warning;
|
||||
bool standard_conforming_strings;
|
||||
|
||||
/*
|
||||
* literalbuf is used to accumulate literal values when multiple rules are
|
||||
* needed to parse a single literal. Call startlit() to reset buffer to
|
||||
* empty, addlit() to add text. NOTE: the string in literalbuf is NOT
|
||||
* necessarily null-terminated, but there always IS room to add a trailing
|
||||
* null at offset literallen. We store a null only when we need it.
|
||||
*/
|
||||
char *literalbuf; /* palloc'd expandable buffer */
|
||||
int literallen; /* actual current string length */
|
||||
int literalalloc; /* current allocated buffer size */
|
||||
|
||||
/*
|
||||
* Random assorted scanner state.
|
||||
*/
|
||||
int state_before_str_stop; /* start cond. before end quote */
|
||||
int xcdepth; /* depth of nesting in slash-star comments */
|
||||
char *dolqstart; /* current $foo$ quote start string */
|
||||
YYLTYPE save_yylloc; /* one-element stack for PUSH_YYLLOC() */
|
||||
|
||||
/* first part of UTF16 surrogate pair for Unicode escapes */
|
||||
int32 utf16_first_part;
|
||||
|
||||
/* state variables for literal-lexing warnings */
|
||||
bool warn_on_first_escape;
|
||||
bool saw_non_ascii;
|
||||
} core_yy_extra_type;
|
||||
|
||||
/*
|
||||
* The type of yyscanner is opaque outside scan.l.
|
||||
*/
|
||||
typedef void *core_yyscan_t;
|
||||
|
||||
/* Support for scanner_errposition_callback function */
|
||||
typedef struct ScannerCallbackState
|
||||
{
|
||||
core_yyscan_t yyscanner;
|
||||
int location;
|
||||
ErrorContextCallback errcallback;
|
||||
} ScannerCallbackState;
|
||||
|
||||
|
||||
/* Constant data exported from parser/scan.l */
|
||||
extern PGDLLIMPORT const uint16 ScanKeywordTokens[];
|
||||
|
||||
/* Entry points in parser/scan.l */
|
||||
extern core_yyscan_t scanner_init(const char *str,
|
||||
core_yy_extra_type *yyext,
|
||||
const ScanKeywordList *keywordlist,
|
||||
const uint16 *keyword_tokens);
|
||||
extern void scanner_finish(core_yyscan_t yyscanner);
|
||||
extern int core_yylex(core_YYSTYPE *lvalp, YYLTYPE *llocp,
|
||||
core_yyscan_t yyscanner);
|
||||
extern int scanner_errposition(int location, core_yyscan_t yyscanner);
|
||||
extern void setup_scanner_errposition_callback(ScannerCallbackState *scbstate,
|
||||
core_yyscan_t yyscanner,
|
||||
int location);
|
||||
extern void cancel_scanner_errposition_callback(ScannerCallbackState *scbstate);
|
||||
extern void scanner_yyerror(const char *message, core_yyscan_t yyscanner) pg_attribute_noreturn();
|
||||
|
||||
#endif /* SCANNER_H */
|
||||
27
db_include/parser/scansup.h
Executable file
27
db_include/parser/scansup.h
Executable file
@@ -0,0 +1,27 @@
|
||||
/*-------------------------------------------------------------------------
|
||||
*
|
||||
* scansup.h
|
||||
* scanner support routines used by the core lexer
|
||||
*
|
||||
* Portions Copyright (c) 1996-2021, PostgreSQL Global Development Group
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* src/include/parser/scansup.h
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#ifndef SCANSUP_H
|
||||
#define SCANSUP_H
|
||||
|
||||
extern char *downcase_truncate_identifier(const char *ident, int len,
|
||||
bool warn);
|
||||
|
||||
extern char *downcase_identifier(const char *ident, int len,
|
||||
bool warn, bool truncate);
|
||||
|
||||
extern void truncate_identifier(char *ident, int len, bool warn);
|
||||
|
||||
extern bool scanner_isspace(char ch);
|
||||
|
||||
#endif /* SCANSUP_H */
|
||||
Reference in New Issue
Block a user