pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Adrian Klaver <adrian.klaver@aklaver.com>
To: 黄宁 <huangning0722@gmail.com>
To: pgsql-general@postgresql.org
Subject: Re: Delete a table automatic?
Date: Tue, 1 Nov 2022 07:35:10 -0700
Message-ID: <e7aaa4f0-0836-29da-974c-b24fa92e1be7@aklaver.com> (raw)
In-Reply-To: <CAKgrFs-PWb3O+aR==f1YYi+ehaBVyuAvy6H3dqwR3NAq9qeGqA@mail.gmail.com>
References: <CAKgrFs-PWb3O+aR==f1YYi+ehaBVyuAvy6H3dqwR3NAq9qeGqA@mail.gmail.com>

On 10/31/22 18:44, 黄宁 wrote:
> I now have two tables named A and B. Table B is calculated based on the 
> data of table A. I wonder if table B can be automatically deleted when 
> table A is deleted?


The only thing I can think of is a sql_drop event trigger:

https://www.postgresql.org/docs/current/functions-event-triggers.html#PG-EVENT-TRIGGER-SQL-DROP-FUNC...

9.29.2. Processing Objects Dropped by a DDL Command

Though this will not be specific to one table.

-- 
Adrian Klaver
adrian.klaver@aklaver.com






view thread (7+ messages)  latest in thread

Message-ID: <e7aaa4f0-0836-29da-974c-b24fa92e1be7@aklaver.com>
Permalink:  ../e7aaa4f0-0836-29da-974c-b24fa92e1be7@aklaver.com/
Also on:    postgresql.org/message-id/e7aaa4f0-0836-29da-974c-b24fa92e1be7@aklaver.com

 · 

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: adrian.klaver@aklaver.com, huangning0722@gmail.com
  Subject: Re: Delete a table automatic?
  In-Reply-To: <e7aaa4f0-0836-29da-974c-b24fa92e1be7@aklaver.com>
  References: <CAKgrFs-PWb3O+aR==f1YYi+ehaBVyuAvy6H3dqwR3NAq9qeGqA@mail.gmail.com> <e7aaa4f0-0836-29da-974c-b24fa92e1be7@aklaver.com>

* 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