From: Michael Paquier <michael@paquier.xyz>
To: Andreas Karlsson <andreas@proxel.se>
Cc: PostgreSQL Developers <pgsql-hackers@lists.postgresql.org>
Subject: Re: Add missing CREATE TABLE IF NOT EXISTS table_name AS EXECUTE query;
Date: Fri, 15 Feb 2019 17:14:51 +0900
Message-ID: <20190215081451.GD2240@paquier.xyz> (raw)
In-Reply-To: <20190211125359.GB3981@paquier.xyz>
References: <2ddcc188-e37c-a0be-32bf-a56b07c3559e@proxel.se>
<20190206114912.GE14980@paquier.xyz>
<2c6f2b5b-a673-fd1c-ad9c-1c7676cee7d6@proxel.se>
<20190207013135.GD4074@paquier.xyz>
<20190211125359.GB3981@paquier.xyz>
On Mon, Feb 11, 2019 at 09:53:59PM +0900, Michael Paquier wrote:
> Let's wait a bit more than the beginning of this week. I forgot about
> this week's minor release, and it is too late to do something about
> this report now, so we will have to wait until the release had
> happened.
OK, committed down to 9.5.
Another thing I have noticed is the following, which is kind of funky
(just rinse and repeat once):
=# EXPLAIN ANALYZE CREATE TABLE IF NOT EXISTS ac AS SELECT 1;
ERROR: 42P07: relation "ac" already exists
LOCATION: heap_create_with_catalog, heap.c:1111
The issue here is that we check for IF NOT EXISTS at the high level of
ExecCreateTableAs, however EXPLAIN takes the lower path of
create_ctas_internal() which enforces if_not_exists to false when
building the CreateStmt object to create the relation. This brings
out a more interesting issue: how should an EXPLAIN behave in this
case? It has nothing to output as the relation already exists.
--
Michael
Attachments:
signature.asc (application/pgp-signature, 832B) download
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-hackers@postgresql.org
Cc: michael@paquier.xyz, andreas@proxel.se, pgsql-hackers@lists.postgresql.org
Subject: Re: Add missing CREATE TABLE IF NOT EXISTS table_name AS EXECUTE query;
In-Reply-To: <20190215081451.GD2240@paquier.xyz>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox