Re: ERROR: relation xxx is still open (Re: Use Trigger to Remove Table ... ) - Mailing list pgsql-general

From Tom Lane
Subject Re: ERROR: relation xxx is still open (Re: Use Trigger to Remove Table ... )
Date
Msg-id 6384.1265127080@sss.pgh.pa.us
Whole thread Raw
In response to ERROR: relation xxx is still open (Re: Use Trigger to Remove Table ... )  (Josh Kupershmidt <schmiddy@gmail.com>)
List pgsql-general
Josh Kupershmidt <schmiddy@gmail.com> writes:
> For the record, I think having a trigger drop a table automatically when
> it's empty is probably a bad idea. But I tried it out anyways, and got a
> surprising:
> ERROR:  relation 16400 is still open
> when the trigger function attempted to drop the table.

> Can anyone say whether the error message I'm seeing is valid?

It's unsurprising, anyway.  The code firing the trigger would be holding
the relation open.  I'm not sure whether there's a good reason for
referring to the table by OID instead of name there, but this is a
pretty low-level failure anyway.

There are any number of reasons why we'd not be likely to try to support
this.  What if the trigger tries to refer to NEW or OLD afterwards, when
the information about the table's rowtype is already gone?  What if
there are more trigger firings pending for the table?

            regards, tom lane

pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: Problem with partition tables and schemas
Next
From: Alvaro Herrera
Date:
Subject: Re: Questions on PostGreSQL Authentication mechanism...