Re: Add missing CREATE TABLE IF NOT EXISTS table_name AS EXECUTEquery;

Поиск
Список
Период
Сортировка
От Michael Paquier
Тема Re: Add missing CREATE TABLE IF NOT EXISTS table_name AS EXECUTEquery;
Дата
Msg-id 20190215081451.GD2240@paquier.xyz
обсуждение исходный текст
Ответ на Re: Add missing CREATE TABLE IF NOT EXISTS table_name AS EXECUTEquery;  (Michael Paquier <michael@paquier.xyz>)
Ответы Re: Add missing CREATE TABLE IF NOT EXISTS table_name AS EXECUTEquery;  (Andreas Karlsson <andreas@proxel.se>)
Список pgsql-hackers
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

Вложения

В списке pgsql-hackers по дате отправления:

Предыдущее
От: Peter Eisentraut
Дата:
Сообщение: Re: INSTALL file
Следующее
От: Michael Paquier
Дата:
Сообщение: Re: 2019-03 CF Summary / Review - Tranche #1