Re: Is there a way to be notified on the CREATE TABLE execution?

From: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
To: Igor Korot <ikorot01(at)gmail(dot)com>
Cc: Francisco Olarte <folarte(at)peoplecall(dot)com>, "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>, pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: Is there a way to be notified on the CREATE TABLE execution?
Date: 2018-06-20 20:02:42
Message-ID: 20180620200242.zfiwrulsieuyao25@alvherre.pgsql
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Mukesh Chhatani 2018-06-20 20:13:24 Re: Postgres 10.4 crashing when using PLV8
Previous Message David G. Johnston 2018-06-20 20:02:19 Re: Postgres 10.4 crashing when using PLV8