postgresql/src/backend
Alvaro Herrera b488c580ae Allow on-the-fly capture of DDL event details
This feature lets user code inspect and take action on DDL events.
Whenever a ddl_command_end event trigger is installed, DDL actions
executed are saved to a list which can be inspected during execution of
a function attached to ddl_command_end.

The set-returning function pg_event_trigger_ddl_commands can be used to
list actions so captured; it returns data about the type of command
executed, as well as the affected object.  This is sufficient for many
uses of this feature.  For the cases where it is not, we also provide a
"command" column of a new pseudo-type pg_ddl_command, which is a
pointer to a C structure that can be accessed by C code.  The struct
contains all the info necessary to completely inspect and even
reconstruct the executed command.

There is no actual deparse code here; that's expected to come later.
What we have is enough infrastructure that the deparsing can be done in
an external extension.  The intention is that we will add some deparsing
code in a later release, as an in-core extension.

A new test module is included.  It's probably insufficient as is, but it
should be sufficient as a starting point for a more complete and
future-proof approach.

Authors: Álvaro Herrera, with some help from Andres Freund, Ian Barwick,
Abhijit Menon-Sen.

Reviews by Andres Freund, Robert Haas, Amit Kapila, Michael Paquier,
Craig Ringer, David Steele.
Additional input from Chris Browne, Dimitri Fontaine, Stephen Frost,
Petr Jelínek, Tom Lane, Jim Nasby, Steven Singer, Pavel Stěhule.

Based on original work by Dimitri Fontaine, though I didn't use his
code.

Discussion:
  https://www.postgresql.org/message-id/m2txrsdzxa.fsf@2ndQuadrant.fr
  https://www.postgresql.org/message-id/20131108153322.GU5809@eldon.alvh.no-ip.org
  https://www.postgresql.org/message-id/20150215044814.GL3391@alvh.no-ip.org
2015-05-11 19:14:31 -03:00
..
access Increase threshold for multixact member emergency autovac to 50%. 2015-05-11 12:15:50 -04:00
bootstrap Add new OID alias type regnamespace 2015-05-09 13:36:52 -04:00
catalog Allow on-the-fly capture of DDL event details 2015-05-11 19:14:31 -03:00
commands Allow on-the-fly capture of DDL event details 2015-05-11 19:14:31 -03:00
executor Code review for foreign/custom join pushdown patch. 2015-05-10 14:36:36 -04:00
foreign Code review for foreign/custom join pushdown patch. 2015-05-10 14:36:36 -04:00
lib Fix a bug in pairing heap removal code. 2015-02-17 22:55:53 +02:00
libpq Change default for include_realm to 1 2015-05-08 19:39:42 -04:00
main Don't require users of src/port/gettimeofday.c to initialize it. 2015-02-21 12:17:04 -05:00
nodes Allow on-the-fly capture of DDL event details 2015-05-11 19:14:31 -03:00
optimizer Code review for foreign/custom join pushdown patch. 2015-05-10 14:36:36 -04:00
parser Allow on-the-fly capture of DDL event details 2015-05-11 19:14:31 -03:00
po Translation updates 2015-02-01 23:23:40 -05:00
port Remove the option to service interrupts during PGSemaphoreLock(). 2015-02-03 23:25:00 +01:00
postmaster Teach autovacuum about multixact member wraparound. 2015-05-08 12:53:00 -04:00
regex Replace a bunch more uses of strncpy() with safer coding. 2015-01-24 13:05:42 -05:00
replication Add macros to check if a filename is a WAL segment or other such file. 2015-05-08 21:58:57 +03:00
rewrite Add support for INSERT ... ON CONFLICT DO NOTHING/UPDATE. 2015-05-08 05:43:10 +02:00
snowball Update copyright for 2015 2015-01-06 11:43:47 -05:00
storage Remove reference to src/tools/backend/index.html 2015-05-08 07:14:18 -04:00
tcop Allow on-the-fly capture of DDL event details 2015-05-11 19:14:31 -03:00
tsearch Define integer limits independently from the system definitions. 2015-04-02 17:43:35 +02:00
utils Allow on-the-fly capture of DDL event details 2015-05-11 19:14:31 -03:00
.gitignore Add gitignore for mingw/cygwin build outputs 2011-06-09 18:11:47 +02:00
Makefile Update copyright for 2015 2015-01-06 11:43:47 -05:00
common.mk Remove maintainer-check target, fold into normal build 2013-10-10 20:11:56 -04:00
nls.mk Translation updates 2015-02-01 23:23:40 -05:00