pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Alvaro Herrera <alvherre@2ndquadrant.com>
To: andrei.pozolotin@gmail.com
To: pgsql-bugs@lists.postgresql.org
Subject: Re: BUG #16177: pg_event_trigger_ddl_commands() returns empty set for ddl_command_start and "drop table"
Date: Mon, 23 Dec 2019 11:36:38 -0300
Message-ID: <20191223143638.GA16273@alvherre.pgsql> (raw)
In-Reply-To: <16177-053a34714817c3e1@postgresql.org>

On 2019-Dec-22, PG Bug reporting form wrote:

> 1. use case is to delete rows with oid references  to the table before "drop
> table"

I think you could achieve that with an event trigger on event sql_drop.
IIRC that event trigger is run for the objects before the drops are
actually executed.

ddl_command_start is pretty useless, because it doesn't have much info
abot the command being run; I'm sure that
pg_event_trigger_ddl_commands() would always return empty there.
The function would return non-empty only during ddl_command_end, but
that's no useful to you because the drops will already have run.

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





view thread (5+ messages)  latest in thread

Message-ID: <20191223143638.GA16273@alvherre.pgsql>
Permalink:  ../20191223143638.GA16273@alvherre.pgsql/
Also on:    postgresql.org/message-id/20191223143638.GA16273@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-bugs@postgresql.org
  Cc: alvherre@2ndquadrant.com, andrei.pozolotin@gmail.com
  Subject: Re: BUG #16177: pg_event_trigger_ddl_commands() returns empty set for ddl_command_start and "drop table"
  In-Reply-To: <20191223143638.GA16273@alvherre.pgsql>
  References: <16177-053a34714817c3e1@postgresql.org> <20191223143638.GA16273@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