On 04/11/2014 05:51 PM, christian@schlichtherle.de wrote:
> The following bug has been logged on the website:
>
> Bug reference: 9956
> Logged by: Christian Schlichtherle
> Email address: christian@schlichtherle.de
> PostgreSQL version: 9.3.4
> Operating system: Mac OS X 10.9.2
> Description:
>
> Apparently, the CREATE TABLE IF NOT EXISTS statement is not properly
> isolated. The following test exposes the issue using JDBC:
>
> <pre><code>
> ...
> </code></pre>
>
> The result of running this test is always the following exception stack
> trace.
>
> <pre><code>
> java.util.concurrent.ExecutionException: org.postgresql.util.PSQLException:
> ERROR: duplicate key value violates unique constraint
> "pg_type_typname_nsp_index"
> Detail: Key (typname, typnamespace)=(foo, 2200) already exists.
Yeah, that's a known issue. See
http://www.postgresql.org/message-id/4F9541D3.1000202@beccati.com.
It's OK for normal DDL commands to rely on the constraint, but I agree
it's pretty surprising for IF NOT EXISTS.
- Heikki