Commit 296f3a60 authored by Alvaro Herrera's avatar Alvaro Herrera

Support more commands in event triggers

COMMENT, SECURITY LABEL, and GRANT/REVOKE now also fire
ddl_command_start and ddl_command_end event triggers, when they operate
on database-local objects.

Reviewed-By: Michael Paquier, Andres Freund, Stephen Frost
parent 88e98230
......@@ -36,7 +36,9 @@
<para>
The <literal>ddl_command_start</> event occurs just before the
execution of a <literal>CREATE</>, <literal>ALTER</>, or <literal>DROP</>
execution of a <literal>CREATE</>, <literal>ALTER</>, <literal>DROP</>,
<literal>SECURITY LABEL</>,
<literal>COMMENT</>, <literal>GRANT</> or <literal>REVOKE</>
command. No check whether the affected object exists or doesn't exist is
performed before the event trigger fires.
As an exception, however, this event does not occur for
......@@ -123,14 +125,15 @@
<table id="event-trigger-by-command-tag">
<title>Event Trigger Support by Command Tag</title>
<tgroup cols="5">
<tgroup cols="6">
<thead>
<row>
<entry>command tag</entry>
<entry>Command Tag</entry>
<entry><literal>ddl_command_start</literal></entry>
<entry><literal>ddl_command_end</literal></entry>
<entry><literal>sql_drop</literal></entry>
<entry><literal>table_rewrite</literal></entry>
<entry>Notes</entry>
</row>
</thead>
<tbody>
......@@ -140,6 +143,7 @@
<entry align="center"><literal>X</literal></entry>
<entry align="center"><literal>-</literal></entry>
<entry align="center"><literal>-</literal></entry>
<entry align="center"></entry>
</row>
<row>
<entry align="left"><literal>ALTER COLLATION</literal></entry>
......@@ -147,6 +151,7 @@
<entry align="center"><literal>X</literal></entry>
<entry align="center"><literal>-</literal></entry>
<entry align="center"><literal>-</literal></entry>
<entry align="center"></entry>
</row>
<row>
<entry align="left"><literal>ALTER CONVERSION</literal></entry>
......@@ -154,6 +159,7 @@
<entry align="center"><literal>X</literal></entry>
<entry align="center"><literal>-</literal></entry>
<entry align="center"><literal>-</literal></entry>
<entry align="center"></entry>
</row>
<row>
<entry align="left"><literal>ALTER DOMAIN</literal></entry>
......@@ -161,6 +167,7 @@
<entry align="center"><literal>X</literal></entry>
<entry align="center"><literal>-</literal></entry>
<entry align="center"><literal>-</literal></entry>
<entry align="center"></entry>
</row>
<row>
<entry align="left"><literal>ALTER EXTENSION</literal></entry>
......@@ -168,6 +175,7 @@
<entry align="center"><literal>X</literal></entry>
<entry align="center"><literal>-</literal></entry>
<entry align="center"><literal>-</literal></entry>
<entry align="center"></entry>
</row>
<row>
<entry align="left"><literal>ALTER FOREIGN DATA WRAPPER</literal></entry>
......@@ -175,6 +183,7 @@
<entry align="center"><literal>X</literal></entry>
<entry align="center"><literal>-</literal></entry>
<entry align="center"><literal>-</literal></entry>
<entry align="center"></entry>
</row>
<row>
<entry align="left"><literal>ALTER FOREIGN TABLE</literal></entry>
......@@ -182,6 +191,7 @@
<entry align="center"><literal>X</literal></entry>
<entry align="center"><literal>X</literal></entry>
<entry align="center"><literal>-</literal></entry>
<entry align="center"></entry>
</row>
<row>
<entry align="left"><literal>ALTER FUNCTION</literal></entry>
......@@ -189,6 +199,7 @@
<entry align="center"><literal>X</literal></entry>
<entry align="center"><literal>-</literal></entry>
<entry align="center"><literal>-</literal></entry>
<entry align="center"></entry>
</row>
<row>
<entry align="left"><literal>ALTER LANGUAGE</literal></entry>
......@@ -196,6 +207,7 @@
<entry align="center"><literal>X</literal></entry>
<entry align="center"><literal>-</literal></entry>
<entry align="center"><literal>-</literal></entry>
<entry align="center"></entry>
</row>
<row>
<entry align="left"><literal>ALTER OPERATOR</literal></entry>
......@@ -203,6 +215,7 @@
<entry align="center"><literal>X</literal></entry>
<entry align="center"><literal>-</literal></entry>
<entry align="center"><literal>-</literal></entry>
<entry align="center"></entry>
</row>
<row>
<entry align="left"><literal>ALTER OPERATOR CLASS</literal></entry>
......@@ -210,6 +223,7 @@
<entry align="center"><literal>X</literal></entry>
<entry align="center"><literal>-</literal></entry>
<entry align="center"><literal>-</literal></entry>
<entry align="center"></entry>
</row>
<row>
<entry align="left"><literal>ALTER OPERATOR FAMILY</literal></entry>
......@@ -217,6 +231,7 @@
<entry align="center"><literal>X</literal></entry>
<entry align="center"><literal>-</literal></entry>
<entry align="center"><literal>-</literal></entry>
<entry align="center"></entry>
</row>
<row>
<entry align="left"><literal>ALTER POLICY</literal></entry>
......@@ -224,6 +239,7 @@
<entry align="center"><literal>X</literal></entry>
<entry align="center"><literal>-</literal></entry>
<entry align="center"><literal>-</literal></entry>
<entry align="center"></entry>
</row>
<row>
<entry align="left"><literal>ALTER SCHEMA</literal></entry>
......@@ -231,6 +247,7 @@
<entry align="center"><literal>X</literal></entry>
<entry align="center"><literal>-</literal></entry>
<entry align="center"><literal>-</literal></entry>
<entry align="center"></entry>
</row>
<row>
<entry align="left"><literal>ALTER SEQUENCE</literal></entry>
......@@ -238,6 +255,7 @@
<entry align="center"><literal>X</literal></entry>
<entry align="center"><literal>-</literal></entry>
<entry align="center"><literal>-</literal></entry>
<entry align="center"></entry>
</row>
<row>
<entry align="left"><literal>ALTER SERVER</literal></entry>
......@@ -245,6 +263,7 @@
<entry align="center"><literal>X</literal></entry>
<entry align="center"><literal>-</literal></entry>
<entry align="center"><literal>-</literal></entry>
<entry align="center"></entry>
</row>
<row>
<entry align="left"><literal>ALTER TABLE</literal></entry>
......@@ -252,6 +271,7 @@
<entry align="center"><literal>X</literal></entry>
<entry align="center"><literal>X</literal></entry>
<entry align="center"><literal>X</literal></entry>
<entry align="center"></entry>
</row>
<row>
<entry align="left"><literal>ALTER TEXT SEARCH CONFIGURATION</literal></entry>
......@@ -259,6 +279,7 @@
<entry align="center"><literal>X</literal></entry>
<entry align="center"><literal>-</literal></entry>
<entry align="center"><literal>-</literal></entry>
<entry align="center"></entry>
</row>
<row>
<entry align="left"><literal>ALTER TEXT SEARCH DICTIONARY</literal></entry>
......@@ -266,6 +287,7 @@
<entry align="center"><literal>X</literal></entry>
<entry align="center"><literal>-</literal></entry>
<entry align="center"><literal>-</literal></entry>
<entry align="center"></entry>
</row>
<row>
<entry align="left"><literal>ALTER TEXT SEARCH PARSER</literal></entry>
......@@ -273,6 +295,7 @@
<entry align="center"><literal>X</literal></entry>
<entry align="center"><literal>-</literal></entry>
<entry align="center"><literal>-</literal></entry>
<entry align="center"></entry>
</row>
<row>
<entry align="left"><literal>ALTER TEXT SEARCH TEMPLATE</literal></entry>
......@@ -280,6 +303,7 @@
<entry align="center"><literal>X</literal></entry>
<entry align="center"><literal>-</literal></entry>
<entry align="center"><literal>-</literal></entry>
<entry align="center"></entry>
</row>
<row>
<entry align="left"><literal>ALTER TRIGGER</literal></entry>
......@@ -287,6 +311,7 @@
<entry align="center"><literal>X</literal></entry>
<entry align="center"><literal>-</literal></entry>
<entry align="center"><literal>-</literal></entry>
<entry align="center"></entry>
</row>
<row>
<entry align="left"><literal>ALTER TYPE</literal></entry>
......@@ -294,6 +319,7 @@
<entry align="center"><literal>X</literal></entry>
<entry align="center"><literal>-</literal></entry>
<entry align="center"><literal>-</literal></entry>
<entry align="center"></entry>
</row>
<row>
<entry align="left"><literal>ALTER USER MAPPING</literal></entry>
......@@ -301,6 +327,7 @@
<entry align="center"><literal>X</literal></entry>
<entry align="center"><literal>-</literal></entry>
<entry align="center"><literal>-</literal></entry>
<entry align="center"></entry>
</row>
<row>
<entry align="left"><literal>ALTER VIEW</literal></entry>
......@@ -308,6 +335,7 @@
<entry align="center"><literal>X</literal></entry>
<entry align="center"><literal>-</literal></entry>
<entry align="center"><literal>-</literal></entry>
<entry align="center"></entry>
</row>
<row>
<entry align="left"><literal>CREATE AGGREGATE</literal></entry>
......@@ -315,6 +343,15 @@
<entry align="center"><literal>X</literal></entry>
<entry align="center"><literal>-</literal></entry>
<entry align="center"><literal>-</literal></entry>
<entry align="center"></entry>
</row>
<row>
<entry align="left"><literal>COMMENT</literal></entry>
<entry align="center"><literal>X</literal></entry>
<entry align="center"><literal>X</literal></entry>
<entry align="center"><literal>-</literal></entry>
<entry align="center"><literal>-</literal></entry>
<entry align="center">Only for local objects</entry>
</row>
<row>
<entry align="left"><literal>CREATE CAST</literal></entry>
......@@ -322,6 +359,7 @@
<entry align="center"><literal>X</literal></entry>
<entry align="center"><literal>-</literal></entry>
<entry align="center"><literal>-</literal></entry>
<entry align="center"></entry>
</row>
<row>
<entry align="left"><literal>CREATE COLLATION</literal></entry>
......@@ -329,6 +367,7 @@
<entry align="center"><literal>X</literal></entry>
<entry align="center"><literal>-</literal></entry>
<entry align="center"><literal>-</literal></entry>
<entry align="center"></entry>
</row>
<row>
<entry align="left"><literal>CREATE CONVERSION</literal></entry>
......@@ -336,6 +375,7 @@
<entry align="center"><literal>X</literal></entry>
<entry align="center"><literal>-</literal></entry>
<entry align="center"><literal>-</literal></entry>
<entry align="center"></entry>
</row>
<row>
<entry align="left"><literal>CREATE DOMAIN</literal></entry>
......@@ -343,6 +383,7 @@
<entry align="center"><literal>X</literal></entry>
<entry align="center"><literal>-</literal></entry>
<entry align="center"><literal>-</literal></entry>
<entry align="center"></entry>
</row>
<row>
<entry align="left"><literal>CREATE EXTENSION</literal></entry>
......@@ -350,6 +391,7 @@
<entry align="center"><literal>X</literal></entry>
<entry align="center"><literal>-</literal></entry>
<entry align="center"><literal>-</literal></entry>
<entry align="center"></entry>
</row>
<row>
<entry align="left"><literal>CREATE FOREIGN DATA WRAPPER</literal></entry>
......@@ -357,6 +399,7 @@
<entry align="center"><literal>X</literal></entry>
<entry align="center"><literal>-</literal></entry>
<entry align="center"><literal>-</literal></entry>
<entry align="center"></entry>
</row>
<row>
<entry align="left"><literal>CREATE FOREIGN TABLE</literal></entry>
......@@ -364,6 +407,7 @@
<entry align="center"><literal>X</literal></entry>
<entry align="center"><literal>-</literal></entry>
<entry align="center"><literal>-</literal></entry>
<entry align="center"></entry>
</row>
<row>
<entry align="left"><literal>CREATE FUNCTION</literal></entry>
......@@ -371,6 +415,7 @@
<entry align="center"><literal>X</literal></entry>
<entry align="center"><literal>-</literal></entry>
<entry align="center"><literal>-</literal></entry>
<entry align="center"></entry>
</row>
<row>
<entry align="left"><literal>CREATE INDEX</literal></entry>
......@@ -378,6 +423,7 @@
<entry align="center"><literal>X</literal></entry>
<entry align="center"><literal>-</literal></entry>
<entry align="center"><literal>-</literal></entry>
<entry align="center"></entry>
</row>
<row>
<entry align="left"><literal>CREATE LANGUAGE</literal></entry>
......@@ -385,6 +431,7 @@
<entry align="center"><literal>X</literal></entry>
<entry align="center"><literal>-</literal></entry>
<entry align="center"><literal>-</literal></entry>
<entry align="center"></entry>
</row>
<row>
<entry align="left"><literal>CREATE OPERATOR</literal></entry>
......@@ -392,6 +439,7 @@
<entry align="center"><literal>X</literal></entry>
<entry align="center"><literal>-</literal></entry>
<entry align="center"><literal>-</literal></entry>
<entry align="center"></entry>
</row>
<row>
<entry align="left"><literal>CREATE OPERATOR CLASS</literal></entry>
......@@ -399,6 +447,7 @@
<entry align="center"><literal>X</literal></entry>
<entry align="center"><literal>-</literal></entry>
<entry align="center"><literal>-</literal></entry>
<entry align="center"></entry>
</row>
<row>
<entry align="left"><literal>CREATE OPERATOR FAMILY</literal></entry>
......@@ -406,6 +455,7 @@
<entry align="center"><literal>X</literal></entry>
<entry align="center"><literal>-</literal></entry>
<entry align="center"><literal>-</literal></entry>
<entry align="center"></entry>
</row>
<row>
<entry align="left"><literal>CREATE POLICY</literal></entry>
......@@ -413,6 +463,7 @@
<entry align="center"><literal>X</literal></entry>
<entry align="center"><literal>-</literal></entry>
<entry align="center"><literal>-</literal></entry>
<entry align="center"></entry>
</row>
<row>
<entry align="left"><literal>CREATE RULE</literal></entry>
......@@ -420,6 +471,7 @@
<entry align="center"><literal>X</literal></entry>
<entry align="center"><literal>-</literal></entry>
<entry align="center"><literal>-</literal></entry>
<entry align="center"></entry>
</row>
<row>
<entry align="left"><literal>CREATE SCHEMA</literal></entry>
......@@ -427,6 +479,7 @@
<entry align="center"><literal>X</literal></entry>
<entry align="center"><literal>-</literal></entry>
<entry align="center"><literal>-</literal></entry>
<entry align="center"></entry>
</row>
<row>
<entry align="left"><literal>CREATE SEQUENCE</literal></entry>
......@@ -434,6 +487,7 @@
<entry align="center"><literal>X</literal></entry>
<entry align="center"><literal>-</literal></entry>
<entry align="center"><literal>-</literal></entry>
<entry align="center"></entry>
</row>
<row>
<entry align="left"><literal>CREATE SERVER</literal></entry>
......@@ -441,6 +495,7 @@
<entry align="center"><literal>X</literal></entry>
<entry align="center"><literal>-</literal></entry>
<entry align="center"><literal>-</literal></entry>
<entry align="center"></entry>
</row>
<row>
<entry align="left"><literal>CREATE TABLE</literal></entry>
......@@ -448,6 +503,7 @@
<entry align="center"><literal>X</literal></entry>
<entry align="center"><literal>-</literal></entry>
<entry align="center"><literal>-</literal></entry>
<entry align="center"></entry>
</row>
<row>
<entry align="left"><literal>CREATE TABLE AS</literal></entry>
......@@ -455,6 +511,7 @@
<entry align="center"><literal>X</literal></entry>
<entry align="center"><literal>-</literal></entry>
<entry align="center"><literal>-</literal></entry>
<entry align="center"></entry>
</row>
<row>
<entry align="left"><literal>CREATE TEXT SEARCH CONFIGURATION</literal></entry>
......@@ -462,6 +519,7 @@
<entry align="center"><literal>X</literal></entry>
<entry align="center"><literal>-</literal></entry>
<entry align="center"><literal>-</literal></entry>
<entry align="center"></entry>
</row>
<row>
<entry align="left"><literal>CREATE TEXT SEARCH DICTIONARY</literal></entry>
......@@ -469,6 +527,7 @@
<entry align="center"><literal>X</literal></entry>
<entry align="center"><literal>-</literal></entry>
<entry align="center"><literal>-</literal></entry>
<entry align="center"></entry>
</row>
<row>
<entry align="left"><literal>CREATE TEXT SEARCH PARSER</literal></entry>
......@@ -476,6 +535,7 @@
<entry align="center"><literal>X</literal></entry>
<entry align="center"><literal>-</literal></entry>
<entry align="center"><literal>-</literal></entry>
<entry align="center"></entry>
</row>
<row>
<entry align="left"><literal>CREATE TEXT SEARCH TEMPLATE</literal></entry>
......@@ -483,6 +543,7 @@
<entry align="center"><literal>X</literal></entry>
<entry align="center"><literal>-</literal></entry>
<entry align="center"><literal>-</literal></entry>
<entry align="center"></entry>
</row>
<row>
<entry align="left"><literal>CREATE TRIGGER</literal></entry>
......@@ -490,6 +551,7 @@
<entry align="center"><literal>X</literal></entry>
<entry align="center"><literal>-</literal></entry>
<entry align="center"><literal>-</literal></entry>
<entry align="center"></entry>
</row>
<row>
<entry align="left"><literal>CREATE TYPE</literal></entry>
......@@ -504,6 +566,7 @@
<entry align="center"><literal>X</literal></entry>
<entry align="center"><literal>-</literal></entry>
<entry align="center"><literal>-</literal></entry>
<entry align="center"></entry>
</row>
<row>
<entry align="left"><literal>CREATE VIEW</literal></entry>
......@@ -511,6 +574,7 @@
<entry align="center"><literal>X</literal></entry>
<entry align="center"><literal>-</literal></entry>
<entry align="center"><literal>-</literal></entry>
<entry align="center"></entry>
</row>
<row>
<entry align="left"><literal>DROP AGGREGATE</literal></entry>
......@@ -518,6 +582,7 @@
<entry align="center"><literal>X</literal></entry>
<entry align="center"><literal>X</literal></entry>
<entry align="center"><literal>-</literal></entry>
<entry align="center"></entry>
</row>
<row>
<entry align="left"><literal>DROP CAST</literal></entry>
......@@ -525,6 +590,7 @@
<entry align="center"><literal>X</literal></entry>
<entry align="center"><literal>X</literal></entry>
<entry align="center"><literal>-</literal></entry>
<entry align="center"></entry>
</row>
<row>
<entry align="left"><literal>DROP COLLATION</literal></entry>
......@@ -532,6 +598,7 @@
<entry align="center"><literal>X</literal></entry>
<entry align="center"><literal>X</literal></entry>
<entry align="center"><literal>-</literal></entry>
<entry align="center"></entry>
</row>
<row>
<entry align="left"><literal>DROP CONVERSION</literal></entry>
......@@ -539,6 +606,7 @@
<entry align="center"><literal>X</literal></entry>
<entry align="center"><literal>X</literal></entry>
<entry align="center"><literal>-</literal></entry>
<entry align="center"></entry>
</row>
<row>
<entry align="left"><literal>DROP DOMAIN</literal></entry>
......@@ -546,6 +614,7 @@
<entry align="center"><literal>X</literal></entry>
<entry align="center"><literal>X</literal></entry>
<entry align="center"><literal>-</literal></entry>
<entry align="center"></entry>
</row>
<row>
<entry align="left"><literal>DROP EXTENSION</literal></entry>
......@@ -553,6 +622,7 @@
<entry align="center"><literal>X</literal></entry>
<entry align="center"><literal>X</literal></entry>
<entry align="center"><literal>-</literal></entry>
<entry align="center"></entry>
</row>
<row>
<entry align="left"><literal>DROP FOREIGN DATA WRAPPER</literal></entry>
......@@ -560,6 +630,7 @@
<entry align="center"><literal>X</literal></entry>
<entry align="center"><literal>X</literal></entry>
<entry align="center"><literal>-</literal></entry>
<entry align="center"></entry>
</row>
<row>
<entry align="left"><literal>DROP FOREIGN TABLE</literal></entry>
......@@ -567,6 +638,7 @@
<entry align="center"><literal>X</literal></entry>
<entry align="center"><literal>X</literal></entry>
<entry align="center"><literal>-</literal></entry>
<entry align="center"></entry>
</row>
<row>
<entry align="left"><literal>DROP FUNCTION</literal></entry>
......@@ -574,6 +646,7 @@
<entry align="center"><literal>X</literal></entry>
<entry align="center"><literal>X</literal></entry>
<entry align="center"><literal>-</literal></entry>
<entry align="center"></entry>
</row>
<row>
<entry align="left"><literal>DROP INDEX</literal></entry>
......@@ -581,6 +654,7 @@
<entry align="center"><literal>X</literal></entry>
<entry align="center"><literal>X</literal></entry>
<entry align="center"><literal>-</literal></entry>
<entry align="center"></entry>
</row>
<row>
<entry align="left"><literal>DROP LANGUAGE</literal></entry>
......@@ -588,6 +662,7 @@
<entry align="center"><literal>X</literal></entry>
<entry align="center"><literal>X</literal></entry>
<entry align="center"><literal>-</literal></entry>
<entry align="center"></entry>
</row>
<row>
<entry align="left"><literal>DROP OPERATOR</literal></entry>
......@@ -595,6 +670,7 @@
<entry align="center"><literal>X</literal></entry>
<entry align="center"><literal>X</literal></entry>
<entry align="center"><literal>-</literal></entry>
<entry align="center"></entry>
</row>
<row>
<entry align="left"><literal>DROP OPERATOR CLASS</literal></entry>
......@@ -602,6 +678,7 @@
<entry align="center"><literal>X</literal></entry>
<entry align="center"><literal>X</literal></entry>
<entry align="center"><literal>-</literal></entry>
<entry align="center"></entry>
</row>
<row>
<entry align="left"><literal>DROP OPERATOR FAMILY</literal></entry>
......@@ -609,6 +686,7 @@
<entry align="center"><literal>X</literal></entry>
<entry align="center"><literal>X</literal></entry>
<entry align="center"><literal>-</literal></entry>
<entry align="center"></entry>
</row>
<row>
<entry align="left"><literal>DROP OWNED</literal></entry>
......@@ -616,6 +694,7 @@
<entry align="center"><literal>X</literal></entry>
<entry align="center"><literal>X</literal></entry>
<entry align="center"><literal>-</literal></entry>
<entry align="center"></entry>
</row>
<row>
<entry align="left"><literal>DROP POLICY</literal></entry>
......@@ -623,6 +702,7 @@
<entry align="center"><literal>X</literal></entry>
<entry align="center"><literal>X</literal></entry>
<entry align="center"><literal>-</literal></entry>
<entry align="center"></entry>
</row>
<row>
<entry align="left"><literal>DROP RULE</literal></entry>
......@@ -630,6 +710,7 @@
<entry align="center"><literal>X</literal></entry>
<entry align="center"><literal>X</literal></entry>
<entry align="center"><literal>-</literal></entry>
<entry align="center"></entry>
</row>
<row>
<entry align="left"><literal>DROP SCHEMA</literal></entry>
......@@ -637,6 +718,7 @@
<entry align="center"><literal>X</literal></entry>
<entry align="center"><literal>X</literal></entry>
<entry align="center"><literal>-</literal></entry>
<entry align="center"></entry>
</row>
<row>
<entry align="left"><literal>DROP SEQUENCE</literal></entry>
......@@ -644,6 +726,7 @@
<entry align="center"><literal>X</literal></entry>
<entry align="center"><literal>X</literal></entry>
<entry align="center"><literal>-</literal></entry>
<entry align="center"></entry>
</row>
<row>
<entry align="left"><literal>DROP SERVER</literal></entry>
......@@ -651,6 +734,7 @@
<entry align="center"><literal>X</literal></entry>
<entry align="center"><literal>X</literal></entry>
<entry align="center"><literal>-</literal></entry>
<entry align="center"></entry>
</row>
<row>
<entry align="left"><literal>DROP TABLE</literal></entry>
......@@ -658,6 +742,7 @@
<entry align="center"><literal>X</literal></entry>
<entry align="center"><literal>X</literal></entry>
<entry align="center"><literal>-</literal></entry>
<entry align="center"></entry>
</row>
<row>
<entry align="left"><literal>DROP TEXT SEARCH CONFIGURATION</literal></entry>
......@@ -665,6 +750,7 @@
<entry align="center"><literal>X</literal></entry>
<entry align="center"><literal>X</literal></entry>
<entry align="center"><literal>-</literal></entry>
<entry align="center"></entry>
</row>
<row>
<entry align="left"><literal>DROP TEXT SEARCH DICTIONARY</literal></entry>
......@@ -672,6 +758,7 @@
<entry align="center"><literal>X</literal></entry>
<entry align="center"><literal>X</literal></entry>
<entry align="center"><literal>-</literal></entry>
<entry align="center"></entry>
</row>
<row>
<entry align="left"><literal>DROP TEXT SEARCH PARSER</literal></entry>
......@@ -679,6 +766,7 @@
<entry align="center"><literal>X</literal></entry>
<entry align="center"><literal>X</literal></entry>
<entry align="center"><literal>-</literal></entry>
<entry align="center"></entry>
</row>
<row>
<entry align="left"><literal>DROP TEXT SEARCH TEMPLATE</literal></entry>
......@@ -686,6 +774,7 @@
<entry align="center"><literal>X</literal></entry>
<entry align="center"><literal>X</literal></entry>
<entry align="center"><literal>-</literal></entry>
<entry align="center"></entry>
</row>
<row>
<entry align="left"><literal>DROP TRIGGER</literal></entry>
......@@ -693,6 +782,7 @@
<entry align="center"><literal>X</literal></entry>
<entry align="center"><literal>X</literal></entry>
<entry align="center"><literal>-</literal></entry>
<entry align="center"></entry>
</row>
<row>
<entry align="left"><literal>DROP TYPE</literal></entry>
......@@ -700,6 +790,7 @@
<entry align="center"><literal>X</literal></entry>
<entry align="center"><literal>X</literal></entry>
<entry align="center"><literal>-</literal></entry>
<entry align="center"></entry>
</row>
<row>
<entry align="left"><literal>DROP USER MAPPING</literal></entry>
......@@ -707,6 +798,7 @@
<entry align="center"><literal>X</literal></entry>
<entry align="center"><literal>X</literal></entry>
<entry align="center"><literal>-</literal></entry>
<entry align="center"></entry>
</row>
<row>
<entry align="left"><literal>DROP VIEW</literal></entry>
......@@ -714,6 +806,15 @@
<entry align="center"><literal>X</literal></entry>
<entry align="center"><literal>X</literal></entry>
<entry align="center"><literal>-</literal></entry>
<entry align="center"></entry>
</row>
<row>
<entry align="left"><literal>GRANT</literal></entry>
<entry align="center"><literal>X</literal></entry>
<entry align="center"><literal>X</literal></entry>
<entry align="center"><literal>-</literal></entry>
<entry align="center"><literal>-</literal></entry>
<entry align="center">Only for local objects</entry>
</row>
<row>
<entry align="left"><literal>IMPORT FOREIGN SCHEMA</literal></entry>
......@@ -721,6 +822,23 @@
<entry align="center"><literal>X</literal></entry>
<entry align="center"><literal>-</literal></entry>
<entry align="center"><literal>-</literal></entry>
<entry align="center"></entry>
</row>
<row>
<entry align="left"><literal>REVOKE</literal></entry>
<entry align="center"><literal>X</literal></entry>
<entry align="center"><literal>X</literal></entry>
<entry align="center"><literal>-</literal></entry>
<entry align="center"><literal>-</literal></entry>
<entry align="center">Only for local objects</entry>
</row>
<row>
<entry align="left"><literal>SECURITY LABEL</literal></entry>
<entry align="center"><literal>X</literal></entry>
<entry align="center"><literal>X</literal></entry>
<entry align="center"><literal>-</literal></entry>
<entry align="center"><literal>-</literal></entry>
<entry align="center">Only for local objects</entry>
</row>
<row>
<entry align="left"><literal>SELECT INTO</literal></entry>
......@@ -728,6 +846,7 @@
<entry align="center"><literal>X</literal></entry>
<entry align="center"><literal>-</literal></entry>
<entry align="center"><literal>-</literal></entry>
<entry align="center"></entry>
</row>
</tbody>
</tgroup>
......
......@@ -267,8 +267,12 @@ check_ddl_tag(const char *tag)
pg_strcasecmp(tag, "REFRESH MATERIALIZED VIEW") == 0 ||
pg_strcasecmp(tag, "ALTER DEFAULT PRIVILEGES") == 0 ||
pg_strcasecmp(tag, "ALTER LARGE OBJECT") == 0 ||
pg_strcasecmp(tag, "COMMENT") == 0 ||
pg_strcasecmp(tag, "GRANT") == 0 ||
pg_strcasecmp(tag, "REVOKE") == 0 ||
pg_strcasecmp(tag, "DROP OWNED") == 0 ||
pg_strcasecmp(tag, "IMPORT FOREIGN SCHEMA") == 0)
pg_strcasecmp(tag, "IMPORT FOREIGN SCHEMA") == 0 ||
pg_strcasecmp(tag, "SECURITY LABEL") == 0)
return EVENT_TRIGGER_COMMAND_TAG_OK;
/*
......@@ -1149,6 +1153,34 @@ EventTriggerSupportsObjectClass(ObjectClass objclass)
return true;
}
bool
EventTriggerSupportsGrantObjectType(GrantObjectType objtype)
{
switch (objtype)
{
case ACL_OBJECT_DATABASE:
case ACL_OBJECT_TABLESPACE:
/* no support for global objects */
return false;
case ACL_OBJECT_COLUMN:
case ACL_OBJECT_RELATION:
case ACL_OBJECT_SEQUENCE:
case ACL_OBJECT_DOMAIN:
case ACL_OBJECT_FDW:
case ACL_OBJECT_FOREIGN_SERVER:
case ACL_OBJECT_FUNCTION:
case ACL_OBJECT_LANGUAGE:
case ACL_OBJECT_LARGEOBJECT:
case ACL_OBJECT_NAMESPACE:
case ACL_OBJECT_TYPE:
return true;
default:
Assert(false);
return true;
}
}
/*
* Prepare event trigger state for a new complete query to run, if necessary;
* returns whether this was done. If it was, EventTriggerEndCompleteQuery must
......
......@@ -513,14 +513,6 @@ standard_ProcessUtility(Node *parsetree,
ExecuteTruncate((TruncateStmt *) parsetree);
break;
case T_CommentStmt:
CommentObject((CommentStmt *) parsetree);
break;
case T_SecLabelStmt:
ExecSecLabelStmt((SecLabelStmt *) parsetree);
break;
case T_CopyStmt:
{
uint64 processed;
......@@ -548,11 +540,6 @@ standard_ProcessUtility(Node *parsetree,
DeallocateQuery((DeallocateStmt *) parsetree);
break;
case T_GrantStmt:
/* no event triggers for global objects */
ExecuteGrantStmt((GrantStmt *) parsetree);
break;
case T_GrantRoleStmt:
/* no event triggers for global objects */
GrantRole((GrantRoleStmt *) parsetree);
......@@ -783,6 +770,19 @@ standard_ProcessUtility(Node *parsetree,
* in some cases, so we "fast path" them in the other cases.
*/
case T_GrantStmt:
{
GrantStmt *stmt = (GrantStmt *) parsetree;
if (EventTriggerSupportsGrantObjectType(stmt->objtype))
ProcessUtilitySlow(parsetree, queryString,
context, params,
dest, completionTag);
else
ExecuteGrantStmt((GrantStmt *) parsetree);
}
break;
case T_DropStmt:
{
DropStmt *stmt = (DropStmt *) parsetree;
......@@ -835,6 +835,32 @@ standard_ProcessUtility(Node *parsetree,
}
break;
case T_CommentStmt:
{
CommentStmt *stmt = (CommentStmt *) parsetree;
if (EventTriggerSupportsObjectType(stmt->objtype))
ProcessUtilitySlow(parsetree, queryString,
context, params,
dest, completionTag);
else
CommentObject((CommentStmt *) parsetree);
break;
}
case T_SecLabelStmt:
{
SecLabelStmt *stmt = (SecLabelStmt *) parsetree;
if (EventTriggerSupportsObjectType(stmt->objtype))
ProcessUtilitySlow(parsetree, queryString,
context, params,
dest, completionTag);
else
ExecSecLabelStmt(stmt);
break;
}
default:
/* All other statement types have event trigger support */
ProcessUtilitySlow(parsetree, queryString,
......@@ -1315,6 +1341,14 @@ ProcessUtilitySlow(Node *parsetree,
ExecAlterOwnerStmt((AlterOwnerStmt *) parsetree);
break;
case T_CommentStmt:
CommentObject((CommentStmt *) parsetree, NULL);
break;
case T_GrantStmt:
ExecuteGrantStmt((GrantStmt *) parsetree);
break;
case T_DropOwnedStmt:
DropOwnedObjects((DropOwnedStmt *) parsetree);
break;
......@@ -1331,6 +1365,10 @@ ProcessUtilitySlow(Node *parsetree,
AlterPolicy((AlterPolicyStmt *) parsetree);
break;
case T_SecLabelStmt:
ExecSecLabelStmt((SecLabelStmt *) parsetree;
break;
default:
elog(ERROR, "unrecognized node type: %d",
(int) nodeTag(parsetree));
......
......@@ -48,6 +48,7 @@ extern void AlterEventTriggerOwner_oid(Oid, Oid newOwnerId);
extern bool EventTriggerSupportsObjectType(ObjectType obtype);
extern bool EventTriggerSupportsObjectClass(ObjectClass objclass);
extern bool EventTriggerSupportsGrantObjectType(GrantObjectType objtype);
extern void EventTriggerDDLCommandStart(Node *parsetree);
extern void EventTriggerDDLCommandEnd(Node *parsetree);
extern void EventTriggerSQLDrop(Node *parsetree);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment