pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Alvaro Herrera <alvherre@2ndquadrant.com>
To: Igor Korot <ikorot01@gmail.com>
Cc: Francisco Olarte <folarte@peoplecall.com>
Cc: David G. Johnston <david.g.johnston@gmail.com>
Cc: pgsql-general <pgsql-general@postgresql.org>
Subject: Re: Is there a way to be notified on the CREATE TABLE execution?
Date: Wed, 20 Jun 2018 16:02:42 -0400
Message-ID: <20180620200242.zfiwrulsieuyao25@alvherre.pgsql> (raw)
In-Reply-To: <CA+FnnTw+-L=VDUQwucB2PEwnTGUtMp=8tej=Z+2UDTr62UF=pg@mail.gmail.com>

On 2018-Jun-20, Igor Korot wrote:

> [quote]
> In order to create an event trigger, you must first create a function
> with the special return type event_trigger. This function need not
> (and may not) return a value; the return type serves merely as a
> signal that the function is to be invoked as an event trigger.
> [/quote]
> 
> So, the function has to be created and compiled.

Event trigger functions can be written in plpgsql.  You can use
pg_event_trigger_ddl_commands() in the ddl_command_end event to obtain a
few tidbits about the DDL that was just executed.

-- 
Álvaro Herrera                https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services




view thread (13+ messages)  latest in thread

Message-ID: <20180620200242.zfiwrulsieuyao25@alvherre.pgsql>
Permalink:  ../20180620200242.zfiwrulsieuyao25@alvherre.pgsql/
Also on:    postgresql.org/message-id/20180620200242.zfiwrulsieuyao25@alvherre.pgsql

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: alvherre@2ndquadrant.com, ikorot01@gmail.com, folarte@peoplecall.com, david.g.johnston@gmail.com
  Subject: Re: Is there a way to be notified on the CREATE TABLE execution?
  In-Reply-To: <20180620200242.zfiwrulsieuyao25@alvherre.pgsql>
  References: <CA+FnnTw+-L=VDUQwucB2PEwnTGUtMp=8tej=Z+2UDTr62UF=pg@mail.gmail.com> <20180620200242.zfiwrulsieuyao25@alvherre.pgsql>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox