Re: Is there a way to be notified on the CREATE TABLE execution? - Mailing list pgsql-general

From Alvaro Herrera
Subject Re: Is there a way to be notified on the CREATE TABLE execution?
Date
Msg-id 20180620200242.zfiwrulsieuyao25@alvherre.pgsql
Whole thread Raw
In response to Re: Is there a way to be notified on the CREATE TABLE execution?  (Igor Korot <ikorot01@gmail.com>)
List pgsql-general
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


pgsql-general by date:

Previous
From: "David G. Johnston"
Date:
Subject: Re: Postgres 10.4 crashing when using PLV8
Next
From: Mukesh Chhatani
Date:
Subject: Re: Postgres 10.4 crashing when using PLV8