init
This commit is contained in:
58
db_include/tcop/cmdtag.h
Executable file
58
db_include/tcop/cmdtag.h
Executable file
@@ -0,0 +1,58 @@
|
||||
/*-------------------------------------------------------------------------
|
||||
*
|
||||
* cmdtag.h
|
||||
* Declarations for commandtag names and enumeration.
|
||||
*
|
||||
* Portions Copyright (c) 1996-2021, PostgreSQL Global Development Group
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* src/include/tcop/cmdtag.h
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
#ifndef CMDTAG_H
|
||||
#define CMDTAG_H
|
||||
|
||||
|
||||
#define PG_CMDTAG(tag, name, evtrgok, rwrok, rowcnt) \
|
||||
tag,
|
||||
|
||||
typedef enum CommandTag
|
||||
{
|
||||
#include "tcop/cmdtaglist.h"
|
||||
COMMAND_TAG_NEXTTAG
|
||||
} CommandTag;
|
||||
|
||||
#undef PG_CMDTAG
|
||||
|
||||
typedef struct QueryCompletion
|
||||
{
|
||||
CommandTag commandTag;
|
||||
uint64 nprocessed;
|
||||
} QueryCompletion;
|
||||
|
||||
|
||||
static inline void
|
||||
SetQueryCompletion(QueryCompletion *qc, CommandTag commandTag,
|
||||
uint64 nprocessed)
|
||||
{
|
||||
qc->commandTag = commandTag;
|
||||
qc->nprocessed = nprocessed;
|
||||
}
|
||||
|
||||
static inline void
|
||||
CopyQueryCompletion(QueryCompletion *dst, const QueryCompletion *src)
|
||||
{
|
||||
dst->commandTag = src->commandTag;
|
||||
dst->nprocessed = src->nprocessed;
|
||||
}
|
||||
|
||||
|
||||
extern void InitializeQueryCompletion(QueryCompletion *qc);
|
||||
extern const char *GetCommandTagName(CommandTag commandTag);
|
||||
extern bool command_tag_display_rowcount(CommandTag commandTag);
|
||||
extern bool command_tag_event_trigger_ok(CommandTag commandTag);
|
||||
extern bool command_tag_table_rewrite_ok(CommandTag commandTag);
|
||||
extern CommandTag GetCommandTagEnum(const char *tagname);
|
||||
|
||||
#endif /* CMDTAG_H */
|
||||
217
db_include/tcop/cmdtaglist.h
Executable file
217
db_include/tcop/cmdtaglist.h
Executable file
@@ -0,0 +1,217 @@
|
||||
/*----------------------------------------------------------------------
|
||||
*
|
||||
* cmdtaglist.h
|
||||
* Command tags
|
||||
*
|
||||
* The command tag list is kept in its own source file for possible use
|
||||
* by automatic tools. The exact representation of a command tag is
|
||||
* determined by the PG_CMDTAG 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
|
||||
*
|
||||
* src/include/tcop/cmdtaglist.h
|
||||
*
|
||||
*----------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* there is deliberately not an #ifndef CMDTAGLIST_H here */
|
||||
|
||||
/*
|
||||
* List of command tags. The entries must be sorted alphabetically on their
|
||||
* textual name, so that we can bsearch on it; see GetCommandTagEnum().
|
||||
*/
|
||||
|
||||
/* symbol name, textual name, event_trigger_ok, table_rewrite_ok, rowcount */
|
||||
PG_CMDTAG(CMDTAG_UNKNOWN, "???", false, false, false)
|
||||
PG_CMDTAG(CMDTAG_ALTER_ACCESS_METHOD, "ALTER ACCESS METHOD", true, false, false)
|
||||
PG_CMDTAG(CMDTAG_ALTER_AGGREGATE, "ALTER AGGREGATE", true, false, false)
|
||||
PG_CMDTAG(CMDTAG_ALTER_CAST, "ALTER CAST", true, false, false)
|
||||
PG_CMDTAG(CMDTAG_ALTER_COLLATION, "ALTER COLLATION", true, false, false)
|
||||
PG_CMDTAG(CMDTAG_ALTER_CONSTRAINT, "ALTER CONSTRAINT", true, false, false)
|
||||
PG_CMDTAG(CMDTAG_ALTER_CONVERSION, "ALTER CONVERSION", true, false, false)
|
||||
PG_CMDTAG(CMDTAG_ALTER_DATABASE, "ALTER DATABASE", false, false, false)
|
||||
PG_CMDTAG(CMDTAG_ALTER_DEFAULT_PRIVILEGES, "ALTER DEFAULT PRIVILEGES", true, false, false)
|
||||
PG_CMDTAG(CMDTAG_ALTER_DOMAIN, "ALTER DOMAIN", true, false, false)
|
||||
PG_CMDTAG(CMDTAG_ALTER_EVENT_TRIGGER, "ALTER EVENT TRIGGER", false, false, false)
|
||||
PG_CMDTAG(CMDTAG_ALTER_EXTENSION, "ALTER EXTENSION", true, false, false)
|
||||
PG_CMDTAG(CMDTAG_ALTER_FOREIGN_DATA_WRAPPER, "ALTER FOREIGN DATA WRAPPER", true, false, false)
|
||||
PG_CMDTAG(CMDTAG_ALTER_FOREIGN_TABLE, "ALTER FOREIGN TABLE", true, false, false)
|
||||
PG_CMDTAG(CMDTAG_ALTER_FUNCTION, "ALTER FUNCTION", true, false, false)
|
||||
PG_CMDTAG(CMDTAG_ALTER_INDEX, "ALTER INDEX", true, false, false)
|
||||
PG_CMDTAG(CMDTAG_ALTER_LANGUAGE, "ALTER LANGUAGE", true, false, false)
|
||||
PG_CMDTAG(CMDTAG_ALTER_LARGE_OBJECT, "ALTER LARGE OBJECT", true, false, false)
|
||||
PG_CMDTAG(CMDTAG_ALTER_MATERIALIZED_VIEW, "ALTER MATERIALIZED VIEW", true, false, false)
|
||||
PG_CMDTAG(CMDTAG_ALTER_OPERATOR, "ALTER OPERATOR", true, false, false)
|
||||
PG_CMDTAG(CMDTAG_ALTER_OPERATOR_CLASS, "ALTER OPERATOR CLASS", true, false, false)
|
||||
PG_CMDTAG(CMDTAG_ALTER_OPERATOR_FAMILY, "ALTER OPERATOR FAMILY", true, false, false)
|
||||
PG_CMDTAG(CMDTAG_ALTER_POLICY, "ALTER POLICY", true, false, false)
|
||||
PG_CMDTAG(CMDTAG_ALTER_PROCEDURE, "ALTER PROCEDURE", true, false, false)
|
||||
PG_CMDTAG(CMDTAG_ALTER_PUBLICATION, "ALTER PUBLICATION", true, false, false)
|
||||
PG_CMDTAG(CMDTAG_ALTER_ROLE, "ALTER ROLE", false, false, false)
|
||||
PG_CMDTAG(CMDTAG_ALTER_ROUTINE, "ALTER ROUTINE", true, false, false)
|
||||
PG_CMDTAG(CMDTAG_ALTER_RULE, "ALTER RULE", true, false, false)
|
||||
PG_CMDTAG(CMDTAG_ALTER_SCHEMA, "ALTER SCHEMA", true, false, false)
|
||||
PG_CMDTAG(CMDTAG_ALTER_SEQUENCE, "ALTER SEQUENCE", true, false, false)
|
||||
PG_CMDTAG(CMDTAG_ALTER_SERVER, "ALTER SERVER", true, false, false)
|
||||
PG_CMDTAG(CMDTAG_ALTER_STATISTICS, "ALTER STATISTICS", true, false, false)
|
||||
PG_CMDTAG(CMDTAG_ALTER_SUBSCRIPTION, "ALTER SUBSCRIPTION", true, false, false)
|
||||
PG_CMDTAG(CMDTAG_ALTER_SYSTEM, "ALTER SYSTEM", false, false, false)
|
||||
PG_CMDTAG(CMDTAG_ALTER_TABLE, "ALTER TABLE", true, true, false)
|
||||
PG_CMDTAG(CMDTAG_ALTER_TABLESPACE, "ALTER TABLESPACE", false, false, false)
|
||||
PG_CMDTAG(CMDTAG_ALTER_TEXT_SEARCH_CONFIGURATION, "ALTER TEXT SEARCH CONFIGURATION", true, false, false)
|
||||
PG_CMDTAG(CMDTAG_ALTER_TEXT_SEARCH_DICTIONARY, "ALTER TEXT SEARCH DICTIONARY", true, false, false)
|
||||
PG_CMDTAG(CMDTAG_ALTER_TEXT_SEARCH_PARSER, "ALTER TEXT SEARCH PARSER", true, false, false)
|
||||
PG_CMDTAG(CMDTAG_ALTER_TEXT_SEARCH_TEMPLATE, "ALTER TEXT SEARCH TEMPLATE", true, false, false)
|
||||
PG_CMDTAG(CMDTAG_ALTER_TRANSFORM, "ALTER TRANSFORM", true, false, false)
|
||||
PG_CMDTAG(CMDTAG_ALTER_TRIGGER, "ALTER TRIGGER", true, false, false)
|
||||
PG_CMDTAG(CMDTAG_ALTER_TYPE, "ALTER TYPE", true, true, false)
|
||||
PG_CMDTAG(CMDTAG_ALTER_USER_MAPPING, "ALTER USER MAPPING", true, false, false)
|
||||
PG_CMDTAG(CMDTAG_ALTER_VIEW, "ALTER VIEW", true, false, false)
|
||||
PG_CMDTAG(CMDTAG_ANALYZE, "ANALYZE", false, false, false)
|
||||
PG_CMDTAG(CMDTAG_BEGIN, "BEGIN", false, false, false)
|
||||
PG_CMDTAG(CMDTAG_CALL, "CALL", false, false, false)
|
||||
PG_CMDTAG(CMDTAG_CHECKPOINT, "CHECKPOINT", false, false, false)
|
||||
PG_CMDTAG(CMDTAG_CLOSE, "CLOSE", false, false, false)
|
||||
PG_CMDTAG(CMDTAG_CLOSE_CURSOR, "CLOSE CURSOR", false, false, false)
|
||||
PG_CMDTAG(CMDTAG_CLOSE_CURSOR_ALL, "CLOSE CURSOR ALL", false, false, false)
|
||||
PG_CMDTAG(CMDTAG_CLUSTER, "CLUSTER", false, false, false)
|
||||
PG_CMDTAG(CMDTAG_COMMENT, "COMMENT", true, false, false)
|
||||
PG_CMDTAG(CMDTAG_COMMIT, "COMMIT", false, false, false)
|
||||
PG_CMDTAG(CMDTAG_COMMIT_PREPARED, "COMMIT PREPARED", false, false, false)
|
||||
PG_CMDTAG(CMDTAG_COPY, "COPY", false, false, true)
|
||||
PG_CMDTAG(CMDTAG_COPY_FROM, "COPY FROM", false, false, false)
|
||||
PG_CMDTAG(CMDTAG_CREATE_ACCESS_METHOD, "CREATE ACCESS METHOD", true, false, false)
|
||||
PG_CMDTAG(CMDTAG_CREATE_AGGREGATE, "CREATE AGGREGATE", true, false, false)
|
||||
PG_CMDTAG(CMDTAG_CREATE_CAST, "CREATE CAST", true, false, false)
|
||||
PG_CMDTAG(CMDTAG_CREATE_COLLATION, "CREATE COLLATION", true, false, false)
|
||||
PG_CMDTAG(CMDTAG_CREATE_CONSTRAINT, "CREATE CONSTRAINT", true, false, false)
|
||||
PG_CMDTAG(CMDTAG_CREATE_CONVERSION, "CREATE CONVERSION", true, false, false)
|
||||
PG_CMDTAG(CMDTAG_CREATE_DATABASE, "CREATE DATABASE", false, false, false)
|
||||
PG_CMDTAG(CMDTAG_CREATE_DOMAIN, "CREATE DOMAIN", true, false, false)
|
||||
PG_CMDTAG(CMDTAG_CREATE_EVENT_TRIGGER, "CREATE EVENT TRIGGER", false, false, false)
|
||||
PG_CMDTAG(CMDTAG_CREATE_EXTENSION, "CREATE EXTENSION", true, false, false)
|
||||
PG_CMDTAG(CMDTAG_CREATE_FOREIGN_DATA_WRAPPER, "CREATE FOREIGN DATA WRAPPER", true, false, false)
|
||||
PG_CMDTAG(CMDTAG_CREATE_FOREIGN_TABLE, "CREATE FOREIGN TABLE", true, false, false)
|
||||
PG_CMDTAG(CMDTAG_CREATE_FUNCTION, "CREATE FUNCTION", true, false, false)
|
||||
PG_CMDTAG(CMDTAG_CREATE_INDEX, "CREATE INDEX", true, false, false)
|
||||
PG_CMDTAG(CMDTAG_CREATE_LANGUAGE, "CREATE LANGUAGE", true, false, false)
|
||||
PG_CMDTAG(CMDTAG_CREATE_MATERIALIZED_VIEW, "CREATE MATERIALIZED VIEW", true, false, false)
|
||||
PG_CMDTAG(CMDTAG_CREATE_OPERATOR, "CREATE OPERATOR", true, false, false)
|
||||
PG_CMDTAG(CMDTAG_CREATE_OPERATOR_CLASS, "CREATE OPERATOR CLASS", true, false, false)
|
||||
PG_CMDTAG(CMDTAG_CREATE_OPERATOR_FAMILY, "CREATE OPERATOR FAMILY", true, false, false)
|
||||
PG_CMDTAG(CMDTAG_CREATE_POLICY, "CREATE POLICY", true, false, false)
|
||||
PG_CMDTAG(CMDTAG_CREATE_PROCEDURE, "CREATE PROCEDURE", true, false, false)
|
||||
PG_CMDTAG(CMDTAG_CREATE_PUBLICATION, "CREATE PUBLICATION", true, false, false)
|
||||
PG_CMDTAG(CMDTAG_CREATE_ROLE, "CREATE ROLE", false, false, false)
|
||||
PG_CMDTAG(CMDTAG_CREATE_ROUTINE, "CREATE ROUTINE", true, false, false)
|
||||
PG_CMDTAG(CMDTAG_CREATE_RULE, "CREATE RULE", true, false, false)
|
||||
PG_CMDTAG(CMDTAG_CREATE_SCHEMA, "CREATE SCHEMA", true, false, false)
|
||||
PG_CMDTAG(CMDTAG_CREATE_SEQUENCE, "CREATE SEQUENCE", true, false, false)
|
||||
PG_CMDTAG(CMDTAG_CREATE_SERVER, "CREATE SERVER", true, false, false)
|
||||
PG_CMDTAG(CMDTAG_CREATE_STATISTICS, "CREATE STATISTICS", true, false, false)
|
||||
PG_CMDTAG(CMDTAG_CREATE_SUBSCRIPTION, "CREATE SUBSCRIPTION", true, false, false)
|
||||
PG_CMDTAG(CMDTAG_CREATE_TABLE, "CREATE TABLE", true, false, false)
|
||||
PG_CMDTAG(CMDTAG_CREATE_TABLE_AS, "CREATE TABLE AS", true, false, false)
|
||||
PG_CMDTAG(CMDTAG_CREATE_TABLESPACE, "CREATE TABLESPACE", false, false, false)
|
||||
PG_CMDTAG(CMDTAG_CREATE_TEXT_SEARCH_CONFIGURATION, "CREATE TEXT SEARCH CONFIGURATION", true, false, false)
|
||||
PG_CMDTAG(CMDTAG_CREATE_TEXT_SEARCH_DICTIONARY, "CREATE TEXT SEARCH DICTIONARY", true, false, false)
|
||||
PG_CMDTAG(CMDTAG_CREATE_TEXT_SEARCH_PARSER, "CREATE TEXT SEARCH PARSER", true, false, false)
|
||||
PG_CMDTAG(CMDTAG_CREATE_TEXT_SEARCH_TEMPLATE, "CREATE TEXT SEARCH TEMPLATE", true, false, false)
|
||||
PG_CMDTAG(CMDTAG_CREATE_TRANSFORM, "CREATE TRANSFORM", true, false, false)
|
||||
PG_CMDTAG(CMDTAG_CREATE_TRIGGER, "CREATE TRIGGER", true, false, false)
|
||||
PG_CMDTAG(CMDTAG_CREATE_TYPE, "CREATE TYPE", true, false, false)
|
||||
PG_CMDTAG(CMDTAG_CREATE_USER_MAPPING, "CREATE USER MAPPING", true, false, false)
|
||||
PG_CMDTAG(CMDTAG_CREATE_VIEW, "CREATE VIEW", true, false, false)
|
||||
PG_CMDTAG(CMDTAG_DEALLOCATE, "DEALLOCATE", false, false, false)
|
||||
PG_CMDTAG(CMDTAG_DEALLOCATE_ALL, "DEALLOCATE ALL", false, false, false)
|
||||
PG_CMDTAG(CMDTAG_DECLARE_CURSOR, "DECLARE CURSOR", false, false, false)
|
||||
PG_CMDTAG(CMDTAG_DELETE, "DELETE", false, false, true)
|
||||
PG_CMDTAG(CMDTAG_DISCARD, "DISCARD", false, false, false)
|
||||
PG_CMDTAG(CMDTAG_DISCARD_ALL, "DISCARD ALL", false, false, false)
|
||||
PG_CMDTAG(CMDTAG_DISCARD_PLANS, "DISCARD PLANS", false, false, false)
|
||||
PG_CMDTAG(CMDTAG_DISCARD_SEQUENCES, "DISCARD SEQUENCES", false, false, false)
|
||||
PG_CMDTAG(CMDTAG_DISCARD_TEMP, "DISCARD TEMP", false, false, false)
|
||||
PG_CMDTAG(CMDTAG_DO, "DO", false, false, false)
|
||||
PG_CMDTAG(CMDTAG_DROP_ACCESS_METHOD, "DROP ACCESS METHOD", true, false, false)
|
||||
PG_CMDTAG(CMDTAG_DROP_AGGREGATE, "DROP AGGREGATE", true, false, false)
|
||||
PG_CMDTAG(CMDTAG_DROP_CAST, "DROP CAST", true, false, false)
|
||||
PG_CMDTAG(CMDTAG_DROP_COLLATION, "DROP COLLATION", true, false, false)
|
||||
PG_CMDTAG(CMDTAG_DROP_CONSTRAINT, "DROP CONSTRAINT", true, false, false)
|
||||
PG_CMDTAG(CMDTAG_DROP_CONVERSION, "DROP CONVERSION", true, false, false)
|
||||
PG_CMDTAG(CMDTAG_DROP_DATABASE, "DROP DATABASE", false, false, false)
|
||||
PG_CMDTAG(CMDTAG_DROP_DOMAIN, "DROP DOMAIN", true, false, false)
|
||||
PG_CMDTAG(CMDTAG_DROP_EVENT_TRIGGER, "DROP EVENT TRIGGER", false, false, false)
|
||||
PG_CMDTAG(CMDTAG_DROP_EXTENSION, "DROP EXTENSION", true, false, false)
|
||||
PG_CMDTAG(CMDTAG_DROP_FOREIGN_DATA_WRAPPER, "DROP FOREIGN DATA WRAPPER", true, false, false)
|
||||
PG_CMDTAG(CMDTAG_DROP_FOREIGN_TABLE, "DROP FOREIGN TABLE", true, false, false)
|
||||
PG_CMDTAG(CMDTAG_DROP_FUNCTION, "DROP FUNCTION", true, false, false)
|
||||
PG_CMDTAG(CMDTAG_DROP_INDEX, "DROP INDEX", true, false, false)
|
||||
PG_CMDTAG(CMDTAG_DROP_LANGUAGE, "DROP LANGUAGE", true, false, false)
|
||||
PG_CMDTAG(CMDTAG_DROP_MATERIALIZED_VIEW, "DROP MATERIALIZED VIEW", true, false, false)
|
||||
PG_CMDTAG(CMDTAG_DROP_OPERATOR, "DROP OPERATOR", true, false, false)
|
||||
PG_CMDTAG(CMDTAG_DROP_OPERATOR_CLASS, "DROP OPERATOR CLASS", true, false, false)
|
||||
PG_CMDTAG(CMDTAG_DROP_OPERATOR_FAMILY, "DROP OPERATOR FAMILY", true, false, false)
|
||||
PG_CMDTAG(CMDTAG_DROP_OWNED, "DROP OWNED", true, false, false)
|
||||
PG_CMDTAG(CMDTAG_DROP_POLICY, "DROP POLICY", true, false, false)
|
||||
PG_CMDTAG(CMDTAG_DROP_PROCEDURE, "DROP PROCEDURE", true, false, false)
|
||||
PG_CMDTAG(CMDTAG_DROP_PUBLICATION, "DROP PUBLICATION", true, false, false)
|
||||
PG_CMDTAG(CMDTAG_DROP_ROLE, "DROP ROLE", false, false, false)
|
||||
PG_CMDTAG(CMDTAG_DROP_ROUTINE, "DROP ROUTINE", true, false, false)
|
||||
PG_CMDTAG(CMDTAG_DROP_RULE, "DROP RULE", true, false, false)
|
||||
PG_CMDTAG(CMDTAG_DROP_SCHEMA, "DROP SCHEMA", true, false, false)
|
||||
PG_CMDTAG(CMDTAG_DROP_SEQUENCE, "DROP SEQUENCE", true, false, false)
|
||||
PG_CMDTAG(CMDTAG_DROP_SERVER, "DROP SERVER", true, false, false)
|
||||
PG_CMDTAG(CMDTAG_DROP_STATISTICS, "DROP STATISTICS", true, false, false)
|
||||
PG_CMDTAG(CMDTAG_DROP_SUBSCRIPTION, "DROP SUBSCRIPTION", true, false, false)
|
||||
PG_CMDTAG(CMDTAG_DROP_TABLE, "DROP TABLE", true, false, false)
|
||||
PG_CMDTAG(CMDTAG_DROP_TABLESPACE, "DROP TABLESPACE", false, false, false)
|
||||
PG_CMDTAG(CMDTAG_DROP_TEXT_SEARCH_CONFIGURATION, "DROP TEXT SEARCH CONFIGURATION", true, false, false)
|
||||
PG_CMDTAG(CMDTAG_DROP_TEXT_SEARCH_DICTIONARY, "DROP TEXT SEARCH DICTIONARY", true, false, false)
|
||||
PG_CMDTAG(CMDTAG_DROP_TEXT_SEARCH_PARSER, "DROP TEXT SEARCH PARSER", true, false, false)
|
||||
PG_CMDTAG(CMDTAG_DROP_TEXT_SEARCH_TEMPLATE, "DROP TEXT SEARCH TEMPLATE", true, false, false)
|
||||
PG_CMDTAG(CMDTAG_DROP_TRANSFORM, "DROP TRANSFORM", true, false, false)
|
||||
PG_CMDTAG(CMDTAG_DROP_TRIGGER, "DROP TRIGGER", true, false, false)
|
||||
PG_CMDTAG(CMDTAG_DROP_TYPE, "DROP TYPE", true, false, false)
|
||||
PG_CMDTAG(CMDTAG_DROP_USER_MAPPING, "DROP USER MAPPING", true, false, false)
|
||||
PG_CMDTAG(CMDTAG_DROP_VIEW, "DROP VIEW", true, false, false)
|
||||
PG_CMDTAG(CMDTAG_EXECUTE, "EXECUTE", false, false, false)
|
||||
PG_CMDTAG(CMDTAG_EXPLAIN, "EXPLAIN", false, false, false)
|
||||
PG_CMDTAG(CMDTAG_FETCH, "FETCH", false, false, true)
|
||||
PG_CMDTAG(CMDTAG_GRANT, "GRANT", true, false, false)
|
||||
PG_CMDTAG(CMDTAG_GRANT_ROLE, "GRANT ROLE", false, false, false)
|
||||
PG_CMDTAG(CMDTAG_IMPORT_FOREIGN_SCHEMA, "IMPORT FOREIGN SCHEMA", true, false, false)
|
||||
PG_CMDTAG(CMDTAG_INSERT, "INSERT", false, false, true)
|
||||
PG_CMDTAG(CMDTAG_LISTEN, "LISTEN", false, false, false)
|
||||
PG_CMDTAG(CMDTAG_LOAD, "LOAD", false, false, false)
|
||||
PG_CMDTAG(CMDTAG_LOCK_TABLE, "LOCK TABLE", false, false, false)
|
||||
PG_CMDTAG(CMDTAG_MOVE, "MOVE", false, false, true)
|
||||
PG_CMDTAG(CMDTAG_NOTIFY, "NOTIFY", false, false, false)
|
||||
PG_CMDTAG(CMDTAG_PREPARE, "PREPARE", false, false, false)
|
||||
PG_CMDTAG(CMDTAG_PREPARE_TRANSACTION, "PREPARE TRANSACTION", false, false, false)
|
||||
PG_CMDTAG(CMDTAG_REASSIGN_OWNED, "REASSIGN OWNED", false, false, false)
|
||||
PG_CMDTAG(CMDTAG_REFRESH_MATERIALIZED_VIEW, "REFRESH MATERIALIZED VIEW", true, false, false)
|
||||
PG_CMDTAG(CMDTAG_REINDEX, "REINDEX", false, false, false)
|
||||
PG_CMDTAG(CMDTAG_RELEASE, "RELEASE", false, false, false)
|
||||
PG_CMDTAG(CMDTAG_RESET, "RESET", false, false, false)
|
||||
PG_CMDTAG(CMDTAG_REVOKE, "REVOKE", true, false, false)
|
||||
PG_CMDTAG(CMDTAG_REVOKE_ROLE, "REVOKE ROLE", false, false, false)
|
||||
PG_CMDTAG(CMDTAG_ROLLBACK, "ROLLBACK", false, false, false)
|
||||
PG_CMDTAG(CMDTAG_ROLLBACK_PREPARED, "ROLLBACK PREPARED", false, false, false)
|
||||
PG_CMDTAG(CMDTAG_SAVEPOINT, "SAVEPOINT", false, false, false)
|
||||
PG_CMDTAG(CMDTAG_SECURITY_LABEL, "SECURITY LABEL", true, false, false)
|
||||
PG_CMDTAG(CMDTAG_SELECT, "SELECT", false, false, true)
|
||||
PG_CMDTAG(CMDTAG_SELECT_FOR_KEY_SHARE, "SELECT FOR KEY SHARE", false, false, false)
|
||||
PG_CMDTAG(CMDTAG_SELECT_FOR_NO_KEY_UPDATE, "SELECT FOR NO KEY UPDATE", false, false, false)
|
||||
PG_CMDTAG(CMDTAG_SELECT_FOR_SHARE, "SELECT FOR SHARE", false, false, false)
|
||||
PG_CMDTAG(CMDTAG_SELECT_FOR_UPDATE, "SELECT FOR UPDATE", false, false, false)
|
||||
PG_CMDTAG(CMDTAG_SELECT_INTO, "SELECT INTO", true, false, false)
|
||||
PG_CMDTAG(CMDTAG_SET, "SET", false, false, false)
|
||||
PG_CMDTAG(CMDTAG_SET_CONSTRAINTS, "SET CONSTRAINTS", false, false, false)
|
||||
PG_CMDTAG(CMDTAG_SHOW, "SHOW", false, false, false)
|
||||
PG_CMDTAG(CMDTAG_START_TRANSACTION, "START TRANSACTION", false, false, false)
|
||||
PG_CMDTAG(CMDTAG_TRUNCATE_TABLE, "TRUNCATE TABLE", false, false, false)
|
||||
PG_CMDTAG(CMDTAG_UNLISTEN, "UNLISTEN", false, false, false)
|
||||
PG_CMDTAG(CMDTAG_UPDATE, "UPDATE", false, false, true)
|
||||
PG_CMDTAG(CMDTAG_VACUUM, "VACUUM", false, false, false)
|
||||
108
db_include/tcop/deparse_utility.h
Executable file
108
db_include/tcop/deparse_utility.h
Executable file
@@ -0,0 +1,108 @@
|
||||
/*-------------------------------------------------------------------------
|
||||
*
|
||||
* deparse_utility.h
|
||||
*
|
||||
* Portions Copyright (c) 1996-2021, PostgreSQL Global Development Group
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* src/include/tcop/deparse_utility.h
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
#ifndef DEPARSE_UTILITY_H
|
||||
#define DEPARSE_UTILITY_H
|
||||
|
||||
#include "access/attnum.h"
|
||||
#include "catalog/objectaddress.h"
|
||||
#include "nodes/nodes.h"
|
||||
#include "utils/aclchk_internal.h"
|
||||
|
||||
|
||||
/*
|
||||
* Support for keeping track of collected commands.
|
||||
*/
|
||||
typedef enum CollectedCommandType
|
||||
{
|
||||
SCT_Simple,
|
||||
SCT_AlterTable,
|
||||
SCT_Grant,
|
||||
SCT_AlterOpFamily,
|
||||
SCT_AlterDefaultPrivileges,
|
||||
SCT_CreateOpClass,
|
||||
SCT_AlterTSConfig
|
||||
} CollectedCommandType;
|
||||
|
||||
/*
|
||||
* For ALTER TABLE commands, we keep a list of the subcommands therein.
|
||||
*/
|
||||
typedef struct CollectedATSubcmd
|
||||
{
|
||||
ObjectAddress address; /* affected column, constraint, index, ... */
|
||||
Node *parsetree;
|
||||
} CollectedATSubcmd;
|
||||
|
||||
typedef struct CollectedCommand
|
||||
{
|
||||
CollectedCommandType type;
|
||||
|
||||
bool in_extension;
|
||||
Node *parsetree;
|
||||
|
||||
union
|
||||
{
|
||||
/* most commands */
|
||||
struct
|
||||
{
|
||||
ObjectAddress address;
|
||||
ObjectAddress secondaryObject;
|
||||
} simple;
|
||||
|
||||
/* ALTER TABLE, and internal uses thereof */
|
||||
struct
|
||||
{
|
||||
Oid objectId;
|
||||
Oid classId;
|
||||
List *subcmds;
|
||||
} alterTable;
|
||||
|
||||
/* GRANT / REVOKE */
|
||||
struct
|
||||
{
|
||||
InternalGrant *istmt;
|
||||
} grant;
|
||||
|
||||
/* ALTER OPERATOR FAMILY */
|
||||
struct
|
||||
{
|
||||
ObjectAddress address;
|
||||
List *operators;
|
||||
List *procedures;
|
||||
} opfam;
|
||||
|
||||
/* CREATE OPERATOR CLASS */
|
||||
struct
|
||||
{
|
||||
ObjectAddress address;
|
||||
List *operators;
|
||||
List *procedures;
|
||||
} createopc;
|
||||
|
||||
/* ALTER TEXT SEARCH CONFIGURATION ADD/ALTER/DROP MAPPING */
|
||||
struct
|
||||
{
|
||||
ObjectAddress address;
|
||||
Oid *dictIds;
|
||||
int ndicts;
|
||||
} atscfg;
|
||||
|
||||
/* ALTER DEFAULT PRIVILEGES */
|
||||
struct
|
||||
{
|
||||
ObjectType objtype;
|
||||
} defprivs;
|
||||
} d;
|
||||
|
||||
struct CollectedCommand *parent; /* when nested */
|
||||
} CollectedCommand;
|
||||
|
||||
#endif /* DEPARSE_UTILITY_H */
|
||||
149
db_include/tcop/dest.h
Executable file
149
db_include/tcop/dest.h
Executable file
@@ -0,0 +1,149 @@
|
||||
/*-------------------------------------------------------------------------
|
||||
*
|
||||
* dest.h
|
||||
* support for communication destinations
|
||||
*
|
||||
* Whenever the backend executes a query that returns tuples, the results
|
||||
* have to go someplace. For example:
|
||||
*
|
||||
* - stdout is the destination only when we are running a
|
||||
* standalone backend (no postmaster) and are returning results
|
||||
* back to an interactive user.
|
||||
*
|
||||
* - a remote process is the destination when we are
|
||||
* running a backend with a frontend and the frontend executes
|
||||
* PQexec() or PQfn(). In this case, the results are sent
|
||||
* to the frontend via the functions in backend/libpq.
|
||||
*
|
||||
* - DestNone is the destination when the system executes
|
||||
* a query internally. The results are discarded.
|
||||
*
|
||||
* dest.c defines three functions that implement destination management:
|
||||
*
|
||||
* BeginCommand: initialize the destination at start of command.
|
||||
* CreateDestReceiver: return a pointer to a struct of destination-specific
|
||||
* receiver functions.
|
||||
* EndCommand: clean up the destination at end of command.
|
||||
*
|
||||
* BeginCommand/EndCommand are executed once per received SQL query.
|
||||
*
|
||||
* CreateDestReceiver returns a receiver object appropriate to the specified
|
||||
* destination. The executor, as well as utility statements that can return
|
||||
* tuples, are passed the resulting DestReceiver* pointer. Each executor run
|
||||
* or utility execution calls the receiver's rStartup method, then the
|
||||
* receiveSlot method (zero or more times), then the rShutdown method.
|
||||
* The same receiver object may be re-used multiple times; eventually it is
|
||||
* destroyed by calling its rDestroy method.
|
||||
*
|
||||
* In some cases, receiver objects require additional parameters that must
|
||||
* be passed to them after calling CreateDestReceiver. Since the set of
|
||||
* parameters varies for different receiver types, this is not handled by
|
||||
* this module, but by direct calls from the calling code to receiver type
|
||||
* specific functions.
|
||||
*
|
||||
* The DestReceiver object returned by CreateDestReceiver may be a statically
|
||||
* allocated object (for destination types that require no local state),
|
||||
* in which case rDestroy is a no-op. Alternatively it can be a palloc'd
|
||||
* object that has DestReceiver as its first field and contains additional
|
||||
* fields (see printtup.c for an example). These additional fields are then
|
||||
* accessible to the DestReceiver functions by casting the DestReceiver*
|
||||
* pointer passed to them. The palloc'd object is pfree'd by the rDestroy
|
||||
* method. Note that the caller of CreateDestReceiver should take care to
|
||||
* do so in a memory context that is long-lived enough for the receiver
|
||||
* object not to disappear while still needed.
|
||||
*
|
||||
* Special provision: None_Receiver is a permanently available receiver
|
||||
* object for the DestNone destination. This avoids useless creation/destroy
|
||||
* calls in portal and cursor manipulations.
|
||||
*
|
||||
*
|
||||
* Portions Copyright (c) 1996-2021, PostgreSQL Global Development Group
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* src/include/tcop/dest.h
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
#ifndef DEST_H
|
||||
#define DEST_H
|
||||
|
||||
#include "executor/tuptable.h"
|
||||
#include "tcop/cmdtag.h"
|
||||
|
||||
|
||||
/* buffer size to use for command completion tags */
|
||||
#define COMPLETION_TAG_BUFSIZE 64
|
||||
|
||||
|
||||
/* ----------------
|
||||
* CommandDest is a simplistic means of identifying the desired
|
||||
* destination. Someday this will probably need to be improved.
|
||||
*
|
||||
* Note: only the values DestNone, DestDebug, DestRemote are legal for the
|
||||
* global variable whereToSendOutput. The other values may be used
|
||||
* as the destination for individual commands.
|
||||
* ----------------
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
DestNone, /* results are discarded */
|
||||
DestDebug, /* results go to debugging output */
|
||||
DestRemote, /* results sent to frontend process */
|
||||
DestRemoteExecute, /* sent to frontend, in Execute command */
|
||||
DestRemoteSimple, /* sent to frontend, w/no catalog access */
|
||||
DestSPI, /* results sent to SPI manager */
|
||||
DestTuplestore, /* results sent to Tuplestore */
|
||||
DestIntoRel, /* results sent to relation (SELECT INTO) */
|
||||
DestCopyOut, /* results sent to COPY TO code */
|
||||
DestSQLFunction, /* results sent to SQL-language func mgr */
|
||||
DestTransientRel, /* results sent to transient relation */
|
||||
DestTupleQueue /* results sent to tuple queue */
|
||||
} CommandDest;
|
||||
|
||||
/* ----------------
|
||||
* DestReceiver is a base type for destination-specific local state.
|
||||
* In the simplest cases, there is no state info, just the function
|
||||
* pointers that the executor must call.
|
||||
*
|
||||
* Note: the receiveSlot routine must be passed a slot containing a TupleDesc
|
||||
* identical to the one given to the rStartup routine. It returns bool where
|
||||
* a "true" value means "continue processing" and a "false" value means
|
||||
* "stop early, just as if we'd reached the end of the scan".
|
||||
* ----------------
|
||||
*/
|
||||
typedef struct _DestReceiver DestReceiver;
|
||||
|
||||
struct _DestReceiver
|
||||
{
|
||||
/* Called for each tuple to be output: */
|
||||
bool (*receiveSlot) (TupleTableSlot *slot,
|
||||
DestReceiver *self);
|
||||
/* Per-executor-run initialization and shutdown: */
|
||||
void (*rStartup) (DestReceiver *self,
|
||||
int operation,
|
||||
TupleDesc typeinfo);
|
||||
void (*rShutdown) (DestReceiver *self);
|
||||
/* Destroy the receiver object itself (if dynamically allocated) */
|
||||
void (*rDestroy) (DestReceiver *self);
|
||||
/* CommandDest code for this receiver */
|
||||
CommandDest mydest;
|
||||
/* Private fields might appear beyond this point... */
|
||||
};
|
||||
|
||||
extern PGDLLIMPORT DestReceiver *None_Receiver; /* permanent receiver for
|
||||
* DestNone */
|
||||
|
||||
/* The primary destination management functions */
|
||||
|
||||
extern void BeginCommand(CommandTag commandTag, CommandDest dest);
|
||||
extern DestReceiver *CreateDestReceiver(CommandDest dest);
|
||||
extern void EndCommand(const QueryCompletion *qc, CommandDest dest,
|
||||
bool force_undecorated_output);
|
||||
extern void EndReplicationCommand(const char *commandTag);
|
||||
|
||||
/* Additional functions that go with destination management, more or less. */
|
||||
|
||||
extern void NullCommand(CommandDest dest);
|
||||
extern void ReadyForQuery(CommandDest dest);
|
||||
|
||||
#endif /* DEST_H */
|
||||
20
db_include/tcop/fastpath.h
Executable file
20
db_include/tcop/fastpath.h
Executable file
@@ -0,0 +1,20 @@
|
||||
/*-------------------------------------------------------------------------
|
||||
*
|
||||
* fastpath.h
|
||||
*
|
||||
*
|
||||
* Portions Copyright (c) 1996-2021, PostgreSQL Global Development Group
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* src/include/tcop/fastpath.h
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
#ifndef FASTPATH_H
|
||||
#define FASTPATH_H
|
||||
|
||||
#include "lib/stringinfo.h"
|
||||
|
||||
extern void HandleFunctionRequest(StringInfo msgBuf);
|
||||
|
||||
#endif /* FASTPATH_H */
|
||||
51
db_include/tcop/pquery.h
Executable file
51
db_include/tcop/pquery.h
Executable file
@@ -0,0 +1,51 @@
|
||||
/*-------------------------------------------------------------------------
|
||||
*
|
||||
* pquery.h
|
||||
* prototypes for pquery.c.
|
||||
*
|
||||
*
|
||||
* Portions Copyright (c) 1996-2021, PostgreSQL Global Development Group
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* src/include/tcop/pquery.h
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
#ifndef PQUERY_H
|
||||
#define PQUERY_H
|
||||
|
||||
#include "nodes/parsenodes.h"
|
||||
#include "utils/portal.h"
|
||||
|
||||
struct PlannedStmt; /* avoid including plannodes.h here */
|
||||
|
||||
|
||||
extern PGDLLIMPORT Portal ActivePortal;
|
||||
|
||||
|
||||
extern PortalStrategy ChoosePortalStrategy(List *stmts);
|
||||
|
||||
extern List *FetchPortalTargetList(Portal portal);
|
||||
|
||||
extern List *FetchStatementTargetList(Node *stmt);
|
||||
|
||||
extern void PortalStart(Portal portal, ParamListInfo params,
|
||||
int eflags, Snapshot snapshot);
|
||||
|
||||
extern void PortalSetResultFormat(Portal portal, int nFormats,
|
||||
int16 *formats);
|
||||
|
||||
extern bool PortalRun(Portal portal, long count, bool isTopLevel,
|
||||
bool run_once, DestReceiver *dest, DestReceiver *altdest,
|
||||
QueryCompletion *qc);
|
||||
|
||||
extern uint64 PortalRunFetch(Portal portal,
|
||||
FetchDirection fdirection,
|
||||
long count,
|
||||
DestReceiver *dest);
|
||||
|
||||
extern bool PlannedStmtRequiresSnapshot(struct PlannedStmt *pstmt);
|
||||
|
||||
extern void EnsurePortalSnapshotExists(void);
|
||||
|
||||
#endif /* PQUERY_H */
|
||||
91
db_include/tcop/tcopprot.h
Executable file
91
db_include/tcop/tcopprot.h
Executable file
@@ -0,0 +1,91 @@
|
||||
/*-------------------------------------------------------------------------
|
||||
*
|
||||
* tcopprot.h
|
||||
* prototypes for postgres.c.
|
||||
*
|
||||
*
|
||||
* Portions Copyright (c) 1996-2021, PostgreSQL Global Development Group
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* src/include/tcop/tcopprot.h
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
#ifndef TCOPPROT_H
|
||||
#define TCOPPROT_H
|
||||
|
||||
#include "nodes/params.h"
|
||||
#include "nodes/parsenodes.h"
|
||||
#include "nodes/plannodes.h"
|
||||
#include "storage/procsignal.h"
|
||||
#include "utils/guc.h"
|
||||
#include "utils/queryenvironment.h"
|
||||
|
||||
|
||||
/* Required daylight between max_stack_depth and the kernel limit, in bytes */
|
||||
#define STACK_DEPTH_SLOP (512 * 1024L)
|
||||
|
||||
extern CommandDest whereToSendOutput;
|
||||
extern PGDLLIMPORT const char *debug_query_string;
|
||||
extern int max_stack_depth;
|
||||
extern int PostAuthDelay;
|
||||
extern int client_connection_check_interval;
|
||||
|
||||
/* GUC-configurable parameters */
|
||||
|
||||
typedef enum
|
||||
{
|
||||
LOGSTMT_NONE, /* log no statements */
|
||||
LOGSTMT_DDL, /* log data definition statements */
|
||||
LOGSTMT_MOD, /* log modification statements, plus DDL */
|
||||
LOGSTMT_ALL /* log all statements */
|
||||
} LogStmtLevel;
|
||||
|
||||
extern PGDLLIMPORT int log_statement;
|
||||
|
||||
extern List *pg_parse_query(const char *query_string);
|
||||
extern List *pg_rewrite_query(Query *query);
|
||||
extern List *pg_analyze_and_rewrite(RawStmt *parsetree,
|
||||
const char *query_string,
|
||||
Oid *paramTypes, int numParams,
|
||||
QueryEnvironment *queryEnv);
|
||||
extern List *pg_analyze_and_rewrite_params(RawStmt *parsetree,
|
||||
const char *query_string,
|
||||
ParserSetupHook parserSetup,
|
||||
void *parserSetupArg,
|
||||
QueryEnvironment *queryEnv);
|
||||
extern PlannedStmt *pg_plan_query(Query *querytree, const char *query_string,
|
||||
int cursorOptions,
|
||||
ParamListInfo boundParams);
|
||||
extern List *pg_plan_queries(List *querytrees, const char *query_string,
|
||||
int cursorOptions,
|
||||
ParamListInfo boundParams);
|
||||
|
||||
extern bool check_max_stack_depth(int *newval, void **extra, GucSource source);
|
||||
extern void assign_max_stack_depth(int newval, void *extra);
|
||||
|
||||
extern void die(SIGNAL_ARGS);
|
||||
extern void quickdie(SIGNAL_ARGS) pg_attribute_noreturn();
|
||||
extern void StatementCancelHandler(SIGNAL_ARGS);
|
||||
extern void FloatExceptionHandler(SIGNAL_ARGS) pg_attribute_noreturn();
|
||||
extern void RecoveryConflictInterrupt(ProcSignalReason reason); /* called from SIGUSR1
|
||||
* handler */
|
||||
extern void ProcessClientReadInterrupt(bool blocked);
|
||||
extern void ProcessClientWriteInterrupt(bool blocked);
|
||||
|
||||
extern void process_postgres_switches(int argc, char *argv[],
|
||||
GucContext ctx, const char **dbname);
|
||||
extern void PostgresMain(int argc, char *argv[],
|
||||
const char *dbname,
|
||||
const char *username) pg_attribute_noreturn();
|
||||
extern long get_stack_depth_rlimit(void);
|
||||
extern void ResetUsage(void);
|
||||
extern void ShowUsage(const char *title);
|
||||
extern int check_log_duration(char *msec_str, bool was_logged);
|
||||
extern void set_debug_options(int debug_flag,
|
||||
GucContext context, GucSource source);
|
||||
extern bool set_plan_disabling_options(const char *arg,
|
||||
GucContext context, GucSource source);
|
||||
extern const char *get_stats_option_name(const char *arg);
|
||||
|
||||
#endif /* TCOPPROT_H */
|
||||
112
db_include/tcop/utility.h
Executable file
112
db_include/tcop/utility.h
Executable file
@@ -0,0 +1,112 @@
|
||||
/*-------------------------------------------------------------------------
|
||||
*
|
||||
* utility.h
|
||||
* prototypes for utility.c.
|
||||
*
|
||||
*
|
||||
* Portions Copyright (c) 1996-2021, PostgreSQL Global Development Group
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* src/include/tcop/utility.h
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
#ifndef UTILITY_H
|
||||
#define UTILITY_H
|
||||
|
||||
#include "tcop/cmdtag.h"
|
||||
#include "tcop/tcopprot.h"
|
||||
|
||||
typedef enum
|
||||
{
|
||||
PROCESS_UTILITY_TOPLEVEL, /* toplevel interactive command */
|
||||
PROCESS_UTILITY_QUERY, /* a complete query, but not toplevel */
|
||||
PROCESS_UTILITY_QUERY_NONATOMIC, /* a complete query, nonatomic
|
||||
* execution context */
|
||||
PROCESS_UTILITY_SUBCOMMAND /* a portion of a query */
|
||||
} ProcessUtilityContext;
|
||||
|
||||
/* Info needed when recursing from ALTER TABLE */
|
||||
typedef struct AlterTableUtilityContext
|
||||
{
|
||||
PlannedStmt *pstmt; /* PlannedStmt for outer ALTER TABLE command */
|
||||
const char *queryString; /* its query string */
|
||||
Oid relid; /* OID of ALTER's target table */
|
||||
ParamListInfo params; /* any parameters available to ALTER TABLE */
|
||||
QueryEnvironment *queryEnv; /* execution environment for ALTER TABLE */
|
||||
} AlterTableUtilityContext;
|
||||
|
||||
/*
|
||||
* These constants are used to describe the extent to which a particular
|
||||
* command is read-only.
|
||||
*
|
||||
* COMMAND_OK_IN_READ_ONLY_TXN means that the command is permissible even when
|
||||
* XactReadOnly is set. This bit should be set for commands that don't change
|
||||
* the state of the database (data or schema) in a way that would affect the
|
||||
* output of pg_dump.
|
||||
*
|
||||
* COMMAND_OK_IN_PARALLEL_MODE means that the command is permissible even
|
||||
* when in parallel mode. Writing tuples is forbidden, as is anything that
|
||||
* might confuse cooperating processes.
|
||||
*
|
||||
* COMMAND_OK_IN_RECOVERY means that the command is permissible even when in
|
||||
* recovery. It can't write WAL, nor can it do things that would imperil
|
||||
* replay of future WAL received from the primary.
|
||||
*/
|
||||
#define COMMAND_OK_IN_READ_ONLY_TXN 0x0001
|
||||
#define COMMAND_OK_IN_PARALLEL_MODE 0x0002
|
||||
#define COMMAND_OK_IN_RECOVERY 0x0004
|
||||
|
||||
/*
|
||||
* We say that a command is strictly read-only if it is sufficiently read-only
|
||||
* for all purposes. For clarity, we also have a constant for commands that are
|
||||
* in no way read-only.
|
||||
*/
|
||||
#define COMMAND_IS_STRICTLY_READ_ONLY \
|
||||
(COMMAND_OK_IN_READ_ONLY_TXN | COMMAND_OK_IN_RECOVERY | \
|
||||
COMMAND_OK_IN_PARALLEL_MODE)
|
||||
#define COMMAND_IS_NOT_READ_ONLY 0
|
||||
|
||||
/* Hook for plugins to get control in ProcessUtility() */
|
||||
typedef void (*ProcessUtility_hook_type) (PlannedStmt *pstmt,
|
||||
const char *queryString,
|
||||
bool readOnlyTree,
|
||||
ProcessUtilityContext context,
|
||||
ParamListInfo params,
|
||||
QueryEnvironment *queryEnv,
|
||||
DestReceiver *dest, QueryCompletion *qc);
|
||||
extern PGDLLIMPORT ProcessUtility_hook_type ProcessUtility_hook;
|
||||
|
||||
extern void ProcessUtility(PlannedStmt *pstmt, const char *queryString,
|
||||
bool readOnlyTree,
|
||||
ProcessUtilityContext context, ParamListInfo params,
|
||||
QueryEnvironment *queryEnv,
|
||||
DestReceiver *dest, QueryCompletion *qc);
|
||||
extern void standard_ProcessUtility(PlannedStmt *pstmt, const char *queryString,
|
||||
bool readOnlyTree,
|
||||
ProcessUtilityContext context, ParamListInfo params,
|
||||
QueryEnvironment *queryEnv,
|
||||
DestReceiver *dest, QueryCompletion *qc);
|
||||
|
||||
extern void ProcessUtilityForAlterTable(Node *stmt,
|
||||
AlterTableUtilityContext *context);
|
||||
|
||||
extern bool UtilityReturnsTuples(Node *parsetree);
|
||||
|
||||
extern TupleDesc UtilityTupleDescriptor(Node *parsetree);
|
||||
|
||||
extern Query *UtilityContainsQuery(Node *parsetree);
|
||||
|
||||
extern CommandTag CreateCommandTag(Node *parsetree);
|
||||
|
||||
static inline const char *
|
||||
CreateCommandName(Node *parsetree)
|
||||
{
|
||||
return GetCommandTagName(CreateCommandTag(parsetree));
|
||||
}
|
||||
|
||||
extern LogStmtLevel GetCommandLogLevel(Node *parsetree);
|
||||
|
||||
extern bool CommandIsReadOnly(PlannedStmt *pstmt);
|
||||
|
||||
#endif /* UTILITY_H */
|
||||
Reference in New Issue
Block a user