Re: Delete a table automatic?

From: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>
To: 黄宁 <huangning0722(at)gmail(dot)com>, pgsql-general(at)postgresql(dot)org
Subject: Re: Delete a table automatic?
Date: 2022-11-01 14:35:10
Message-ID: e7aaa4f0-0836-29da-974c-b24fa92e1be7@aklaver.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

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-FUNCTIONS

9.29.2. Processing Objects Dropped by a DDL Command

Though this will not be specific to one table.

--
Adrian Klaver
adrian(dot)klaver(at)aklaver(dot)com

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message MuraliPD@GMail 2022-11-01 15:11:24 Re: Delete a table automatic?
Previous Message Peter J. Holzer 2022-11-01 14:16:03 Re: Delete a table automatic?