Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1WYhXa-0006tl-Ul for pgsql-bugs@arkaria.postgresql.org; Fri, 11 Apr 2014 19:55:11 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1WYhXa-0004lm-D6 for pgsql-bugs@arkaria.postgresql.org; Fri, 11 Apr 2014 19:55:10 +0000 Received: from makus.postgresql.org ([2001:4800:7903:4::125]) by malur.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1WYhXZ-0004lX-BA for pgsql-bugs@postgresql.org; Fri, 11 Apr 2014 19:55:09 +0000 Received: from smtp-outbound-2.vmware.com ([208.91.2.13]) by makus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1WYhXW-0004yG-K5 for pgsql-bugs@postgresql.org; Fri, 11 Apr 2014 19:55:08 +0000 Received: from sc9-mailhost3.vmware.com (sc9-mailhost3.vmware.com [10.113.161.73]) by smtp-outbound-2.vmware.com (Postfix) with ESMTP id 5C1A12824D; Fri, 11 Apr 2014 12:55:04 -0700 (PDT) Received: from zcs-prod-ext-mta-2.vmware.com (zcs-prod-ext-mta-2.vmware.com [10.113.62.224]) by sc9-mailhost3.vmware.com (Postfix) with ESMTP id 5622548117; Fri, 11 Apr 2014 12:55:04 -0700 (PDT) Received: from zcs-prod-ext-mta-2.vmware.com (localhost.localdomain [127.0.0.1]) by zcs-prod-ext-mta-2.vmware.com (Postfix) with ESMTP id 5653DC0064; Fri, 11 Apr 2014 12:54:57 -0700 (PDT) Received: from [192.168.1.90] (zimbra-prod-ext-proxy-vip.vmware.com [10.113.63.87]) by zcs-prod-ext-mta-2.vmware.com (Postfix) with ESMTPSA; Fri, 11 Apr 2014 12:54:56 -0700 (PDT) Message-ID: <53484895.80209@vmware.com> Date: Fri, 11 Apr 2014 22:55:01 +0300 From: Heikki Linnakangas Organization: VMware User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Icedove/24.4.0 MIME-Version: 1.0 To: christian@schlichtherle.de, pgsql-bugs@postgresql.org Subject: Re: BUG #9956: Concurrency bug in CREATE TABLE IF NOT EXISTS statement References: <20140411145120.10532.93247@wrigleys.postgresql.org> In-Reply-To: <20140411145120.10532.93247@wrigleys.postgresql.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Pg-Spam-Score: -7.3 (-------) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org 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: > >

> ...
> 
> > The result of running this test is always the following exception stack > trace. > >

> 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


-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs