Re: Add CREATE support to event triggers

From: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
To: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
Cc: Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Add CREATE support to event triggers
Date: 2014-10-13 03:45:19
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Alvaro Herrera wrote:
> Actually here's a different split of these patches, which I hope makes
> more sense. My intention here is that patches 0001 to 0004 are simple
> changes that can be pushed right away; they are not directly related to
> the return-creation-command feature. Patches 0005 to 0027 implement
> that feature incrementally. You can see in patch 0005 the DDL commands
> that are still not implemented in deparse (they are the ones that have
> an elog(ERROR) rather than a "command = NULL"). Patch 0006 adds calls
> in ProcessUtilitySlow() to each command, so that the object(s) being
> touched are added to the event trigger command stash.
> Patches from 0007 to 0027 (excepting patch 0017) implement one or a
> small number of commands in deparse. Patch 0017 is necessary
> infrastructure in ALTER TABLE to support deparsing that one.
> My intention with the later patches is that they would all be pushed as
> a single commit, i.e. the deparse support would be implemented for all
> commands in a fell swoop rather than piecemeal -- except possibly patch
> 0017 (the ALTER TABLE infrastructure). I split them up only for ease of
> review. Of course, before pushing we (I) need to implement deparsing
> for all the remaining commands.

Here's a new version of this series. The main change is that I've
changed deparse_utility.c to generate JSON, and the code that was in
commands/event_trigger.c to decode that JSON, so that it uses the new
Jsonb API instead. In addition, I've moved the new code that was in
commands/event_trigger.c to utils/adt/ddl_json.c. (The only entry point
of the new file is the SQL-callable pg_event_trigger_expand_command()
function, and its purpose is to expand a JSON object emitted by the
deparse_utility.c code back into a plain text SQL command.)

I have also cleaned up the code per comments from Michael Paquier and
Andres Freund:

* the GRANT support for event triggers now correctly ignores global

* COMMENT ON .. IS NULL no longer causes a crash

* renameatt() and ExecRenameStmt are consistent in returning the
objSubId as an "int" (not int32). This is what is used as objectSubId
in ObjectAddress, which is what we're using this value for.

Álvaro Herrera
PostgreSQL Development, 24x7 Support, Training & Services

Attachment Content-Type Size
0001-deparse-core-have-RENAME-return-attribute-number.patch text/x-diff 4.9 KB
0002-deparse-core-event-triggers-support-GRANT-REVOKE.patch text/x-diff 5.7 KB
0003-deparse-core-event-triggers-support-COMMENT.patch text/x-diff 4.6 KB
0004-deparse-infrastructure-needed-for-command-deparsing.patch text/x-diff 62.8 KB
0005-deparse-sprinkle-EventTriggerStashCommand-calls.patch text/x-diff 19.4 KB
0006-deparse-Support-CREATE-TYPE-AS.patch text/x-diff 9.5 KB
0007-deparse-Support-CREATE-TYPE-AS-ENUM.patch text/x-diff 1.8 KB
0008-deparse-Support-CREATE-SCHEMA-TABLE-SEQUENCE-INDEX-T.patch text/x-diff 44.4 KB
0009-deparse-Support-CREATE-TYPE-AS-RANGE.patch text/x-diff 4.2 KB
0010-deparse-Support-CREATE-EXTENSION.patch text/x-diff 3.5 KB
0011-deparse-Support-CREATE-RULE.patch text/x-diff 6.8 KB
0012-deparse-Support-ALTER-TYPE-ADD-VALUE-enums.patch text/x-diff 1.9 KB
0013-deparse-Support-for-ALTER-OBJECT-RENAME.patch text/x-diff 9.3 KB
0014-deparse-Support-CREATE-DOMAIN.patch text/x-diff 2.5 KB
0015-deparse-Support-CREATE-FUNCTION.patch text/x-diff 12.0 KB
0016-deparse-core-have-ALTER-TABLE-return-OIDs-and-col-of.patch text/x-diff 37.0 KB
0017-deparse-Support-ALTER-TABLE.patch text/x-diff 23.0 KB
0018-deparse-Support-CREATE-VIEW.patch text/x-diff 3.0 KB
0019-deparse-Support-CREATE-OPERATOR-FAMILY.patch text/x-diff 2.2 KB
0020-deparse-Support-CREATE-CONVERSION.patch text/x-diff 2.5 KB
0021-deparse-Support-DefineStmt-commands.patch text/x-diff 25.2 KB
0022-deparse-support-ALTER-THING-OWNER-TO.patch text/x-diff 1.5 KB
0023-deparse-Support-ALTER-EXTENSION-UPDATE-TO.patch text/x-diff 2.1 KB
0024-deparse-Support-GRANT-REVOKE.patch text/x-diff 15.3 KB
0025-deparse-Support-ALTER-FUNCTION.patch text/x-diff 3.8 KB
0026-deparse-support-COMMENT-ON.patch text/x-diff 1.8 KB

In response to


Browse pgsql-hackers by date

  From Date Subject
Next Message Fabrízio de Royes Mello 2014-10-13 04:25:47 Re: Proposal : REINDEX SCHEMA
Previous Message Tomas Vondra 2014-10-12 22:00:53 WIP: multivariate statistics / proof of concept