Re: Server error

From: Stephan Szabo <sszabo(at)megazone23(dot)bigpanda(dot)com>
To: <gitarrerik(at)musiker(dot)nu>
Cc: <pgsql-general(at)postgresql(dot)org>
Subject: Re: Server error
Date: 2003-05-08 21:53:57
Message-ID: 20030508141631.T47551-100000@megazone23.bigpanda.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Thu, 8 May 2003, [iso-8859-1] Erik Ronstrm wrote:

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

I can reproduce on 7.2 but not 7.3 or 7.4. It looks like something is
getting clobbered. When I recompiled with debug and asserting, I get a
crash the first time the function is called. You may need to go through
with a debugger.

> One question is: is it always safe to create a foreign key constraint,
> even when the table contains data?

It'll error if the constraint is violated or invalid, but otherwise it
should be.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Dennis Gearon 2003-05-08 22:04:24 Re: Server error
Previous Message Jeff Holle 2003-05-08 21:36:01 Error executing dbcreate