deparse: infrastructure needed for command deparsing
authorAlvaro Herrera <alvherre@alvh.no-ip.org>
Wed, 24 Sep 2014 18:53:04 +0000 (15:53 -0300)
committerAlvaro Herrera <alvherre@alvh.no-ip.org>
Tue, 7 Apr 2015 17:09:36 +0000 (14:09 -0300)
commiteea2c39a4c776c47818d6e993c1909aa05e938ec
treec60f3fc7591d41bc54d2f62994a4644eb9bf2052
parent4acfd13c9af378ca1c786fdaf339c106a73c060e
deparse: infrastructure needed for command deparsing

This patch introduces unused infrastructure for command deparsing.
There are three main parts:

1. A list (stash) of executed commands in Node format, stored in the
event trigger state.  At ddl_command_end, the stored items can be
extracted.  For now this only support "basic" commands (in particular
not ALTER TABLE or GRANT).  It's useful enough to cover all CREATE
command as well as many simple ALTER forms.

2. Support code to enable writing routines that convert the Node format
into a JSON blob.  This JSON representation allows extracting and
modifying individual parts of the command.

3. Code to convert the JSON blobs back into plain strings.

No actual routines to convert Node into JSON is provided by this patch;
that is left to later patches.  This split is only presented as is for
ease of review.
13 files changed:
src/backend/commands/event_trigger.c
src/backend/tcop/Makefile
src/backend/tcop/deparse_utility.c [new file with mode: 0644]
src/backend/tcop/utility.c
src/backend/utils/adt/Makefile
src/backend/utils/adt/ddl_json.c [new file with mode: 0644]
src/backend/utils/adt/format_type.c
src/include/catalog/pg_proc.h
src/include/commands/event_trigger.h
src/include/commands/extension.h
src/include/nodes/parsenodes.h
src/include/tcop/deparse_utility.h [new file with mode: 0644]
src/include/utils/builtins.h