Looks heap_create_with_catalog ignored the if_not_exists options - Mailing list pgsql-hackers

From Andy Fan
Subject Looks heap_create_with_catalog ignored the if_not_exists options
Date
Msg-id CAKU4AWpGFMgp3zF-8TUkpydPZ5kJcY-yWcdN92mwRnSbJW2zhQ@mail.gmail.com
Whole thread Raw
Responses Re: Looks heap_create_with_catalog ignored the if_not_exists options
List pgsql-hackers
for a createStmt,  it will call transformCreateStmt,  and then heap_create_with_catalog. 
but looks it just check the if_not_exists in transformCreateStmt.  

so there is a chance that when the transformCreateStmt is called, the table is not created, but before the heap_create_with_catalog is called,  the table was created.  if so, the "if not exits" will raise error  "ERROR:  relation "xxxx" already exists"

I can reproduce this with gdb, 

demo=# create table if not exists dddd2 (a int);
ERROR:  relation "dddd2" already exists

is it designed as this on purpose or is it a bug?

I am using the lates commit on github now. 

pgsql-hackers by date:

Previous
From: Antonin Houska
Date:
Subject: Re: Problems with plan estimates in postgres_fdw
Next
From: Švorc Martin
Date:
Subject: pg_background and BGWH_STOPPED