Re: Delete a table automatic?

2022-11-01 Thread Tom Lane
Adrian Klaver writes: > 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: I wonder

Re: Delete a table automatic?

2022-11-01 Thread MuraliPD@GMail
Hi, I too agree with Adrian Klaver, the trigger is the only option Thanks, V Muralidharan +91 9940302900 On Tue, 1 Nov 2022, 19:46 Peter J. Holzer, wrote: > On 2022-11-01 07:41:14 -0600, Rob Sargent wrote: > > On 11/1/22 03:31, jian he wrote: > > > > On Tue, Nov 1, 2022 at 2:33 PM 黄宁 wr

Re: Delete a table automatic?

2022-11-01 Thread Adrian Klaver
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/f

Re: Delete a table automatic?

2022-11-01 Thread Peter J. Holzer
On 2022-11-01 07:41:14 -0600, Rob Sargent wrote: > On 11/1/22 03:31, jian he wrote: > > On Tue, Nov 1, 2022 at 2:33 PM 黄宁 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

Re: Delete a table automatic?

2022-11-01 Thread Rob Sargent
On 11/1/22 03:31, jian he wrote: On Tue, Nov 1, 2022 at 2:33 PM 黄宁 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? Your question seems not that specific. You

Re: Delete a table automatic?

2022-11-01 Thread jian he
On Tue, Nov 1, 2022 at 2:33 PM 黄宁 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? > Your question seems not that specific. You can use https://dbfiddle.uk/btGcOH30 to s

Delete a table automatic?

2022-11-01 Thread 黄宁
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?