postgresql/src
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
..
backend Allow on-the-fly capture of DDL event details 2015-05-11 19:14:31 -03:00
bin pg_upgrade: use single or double-quotes in command-line strings 2015-05-11 12:57:48 -04:00
common Reorganize our CRC source files again. 2015-04-14 17:03:42 +03:00
include Allow on-the-fly capture of DDL event details 2015-05-11 19:14:31 -03:00
interfaces Fix parallel make risk with new check temp-install setup 2015-04-29 20:34:22 -04:00
makefiles Fix parallel make risk with new check temp-install setup 2015-04-29 20:34:22 -04:00
pl Fix python_includespec on Windows at configure time 2015-05-03 08:17:04 -04:00
port Fix various typos and grammar errors in comments. 2015-04-26 18:42:31 +02:00
template Remove duplicate specification of -Ae for HP-UX C compiler. 2015-01-13 22:52:11 -05:00
test Allow on-the-fly capture of DDL event details 2015-05-11 19:14:31 -03:00
timezone Update time zone data files to tzdata release 2015a. 2015-01-30 22:45:44 -05:00
tools Enable transforms tests for python 2 on MSVC builds 2015-04-29 13:49:24 -04:00
tutorial Update copyright for 2015 2015-01-06 11:43:47 -05:00
.gitignore Convert cvsignore to gitignore, and add .gitignore for build targets. 2010-09-22 12:57:04 +02:00
DEVELOPERS
Makefile Create libpgcommon, and move pg_malloc et al to it 2013-02-12 11:21:05 -03:00
Makefile.global.in Move interpreter shared library detection to configure 2015-05-01 21:38:21 -04:00
Makefile.shlib Add transforms feature 2015-04-26 10:33:14 -04:00
bcc32.mak Autoconfiscate selection of 64-bit int type for 64-bit large object API. 2012-10-07 21:52:43 -04:00
nls-global.mk Setup error context callback for transaction lock waits 2014-03-19 15:10:36 -03:00
win32.mak Autoconfiscate selection of 64-bit int type for 64-bit large object API. 2012-10-07 21:52:43 -04:00