Re: BUG #3692: Conflicting create table statements throw unexpected error - Mailing list pgsql-bugs

From Tom Lane
Subject Re: BUG #3692: Conflicting create table statements throw unexpected error
Date
Msg-id 26493.1193089499@sss.pgh.pa.us
Whole thread Raw
In response to BUG #3692: Conflicting create table statements throw unexpected error  ("Bill Moran" <wmoran@collaborativefusion.com>)
Responses Re: BUG #3692: Conflicting create table statements throw unexpected error
List pgsql-bugs
"Bill Moran" <wmoran@collaborativefusion.com> writes:
> Issuing a statement like:
> CREATE TABLE table2 AS SELECT * FROM table1;
> simultaneously in two separate sessions should result in an error like
> "ERROR:  relation "table2" already exists" (in one or the other of the
> sessions, depending on the exact timing of things).

This isn't really fixable, or at least the cure would be worse than the
disease.  The "already exists" message is just a pre-check and it cannot
detect an uncommitted concurrent attempt to insert the same table name.
The place where the rubber really meets the road is during unique index
insertion.  We might be able to fix things so that you get a unique
index complaint about pg_class.relname instead of pg_type, but that
would be about it.

            regards, tom lane

pgsql-bugs by date:

Previous
From: "Bill Moran"
Date:
Subject: BUG #3692: Conflicting create table statements throw unexpected error
Next
From: Bill Moran
Date:
Subject: Re: BUG #3692: Conflicting create table statements throw unexpected error