name your tables with some sort of sequence and a concatenation like:
create table 'temp' || next_val(blah blah) AS blah blah, making sure to delete of course :-)
It will avoid any race conditions on cleanup. Do this for awhile, and check the catalogs and make sure that everything
DOESget cleaned up.
Erik Ronström wrote:
> Hello,
>
> Still stuck with the same error. Finally managed to upgrade from 7.2.1
> to 7.2.4, and realized that the problem is still there. Shit! I've not
> yet been able to reproduce the problem on another location, but at
> least I've isolated it a bit:
>
> I have a function which creates a "cache" table with a subset of rows
> from another table (CREATE TABLE new AS SELECT ... FROM old WHERE ...).
> Then it adds a foreign key (ALTER TABLE new ADD CONSTRAINT ref FOREIGN
> KEY ... REFERENCES old). Everything is fine so far. Now, if I drop the
> new table and run the function again, postgres crashes.
>
> Things to note:
> 1) If the old table doesn't contain any rows *when running the query
> the first time*, there is no crash the second time.
> 2) If I execute the queries from the function "manually", typing them
> into psql, everything works fine.
>
> Looks to me like there is some sort of cleanup problem, since it is
> almost always the second run (in each session) that crashes.
>
> One question is: is it always safe to create a foreign key constraint,
> even when the table contains data?
>
> Erik
>
> __________________________________________________
> Yahoo! Plus
> For a better Internet experience
> http://www.yahoo.co.uk/btoffer
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 6: Have you searched our list archives?
>
> http://archives.postgresql.org
>
>