summaryrefslogtreecommitdiffstats
path: root/src/include/tcop/deparse_utility.h
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-04 12:17:33 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-04 12:17:33 +0000
commit5e45211a64149b3c659b90ff2de6fa982a5a93ed (patch)
tree739caf8c461053357daa9f162bef34516c7bf452 /src/include/tcop/deparse_utility.h
parentInitial commit. (diff)
downloadpostgresql-15-5e45211a64149b3c659b90ff2de6fa982a5a93ed.tar.xz
postgresql-15-5e45211a64149b3c659b90ff2de6fa982a5a93ed.zip
Adding upstream version 15.5.upstream/15.5
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/include/tcop/deparse_utility.h')
-rw-r--r--src/include/tcop/deparse_utility.h108
1 files changed, 108 insertions, 0 deletions
diff --git a/src/include/tcop/deparse_utility.h b/src/include/tcop/deparse_utility.h
new file mode 100644
index 0000000..94de13d
--- /dev/null
+++ b/src/include/tcop/deparse_utility.h
@@ -0,0 +1,108 @@
+/*-------------------------------------------------------------------------
+ *
+ * deparse_utility.h
+ *
+ * Portions Copyright (c) 1996-2022, 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 */