'Create table if not exists as' breaks SPI_execute

Lists: pgsql-hackers
From: Stas Kelvich <s(dot)kelvich(at)postgrespro(dot)ru>
To: PostgreSQL mailing lists <pgsql-hackers(at)postgresql(dot)org>
Subject: 'Create table if not exists as' breaks SPI_execute
Date: 2016-04-11 15:41:14
Message-ID: 723ED897-E2E3-4A2B-B693-CA7CAC681FBB@postgrespro.ru
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Hi.

SPI_execute assumes that CreateTableAsStmt always have completionTag == “completionTag”.
But it isn’t true in case of ‘IF NOT EXISTS’ present.

Attachment Content-Type Size
spi-cta.patch application/octet-stream 1.0 KB
unknown_filename text/plain 95 bytes

From: Stas Kelvich <s(dot)kelvich(at)postgrespro(dot)ru>
To: Stas Kelvich <s(dot)kelvich(at)postgrespro(dot)ru>
Cc: PostgreSQL mailing lists <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: 'Create table if not exists as' breaks SPI_execute
Date: 2016-04-11 15:48:37
Message-ID: 15DC2E4C-1663-4A5A-A2F5-916029772C82@postgrespro.ru
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

> On 11 Apr 2016, at 18:41, Stas Kelvich <s(dot)kelvich(at)postgrespro(dot)ru> wrote:
>
> Hi.
>
> SPI_execute assumes that CreateTableAsStmt always have completionTag == “completionTag”.
> But it isn’t true in case of ‘IF NOT EXISTS’ present.
>
>
> <spi-cta.patch>

Sorry, I meant completionTag == “SELECT”.

--
Stas Kelvich
Postgres Professional: http://www.postgrespro.com
Russian Postgres Company


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Stas Kelvich <s(dot)kelvich(at)postgrespro(dot)ru>
Cc: PostgreSQL mailing lists <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: 'Create table if not exists as' breaks SPI_execute
Date: 2016-04-12 00:07:49
Message-ID: 18071.1460419669@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Stas Kelvich <s(dot)kelvich(at)postgrespro(dot)ru> writes:
> SPI_execute assumes that CreateTableAsStmt always have completionTag == completionTag.
> But it isnt true in case of IF NOT EXISTS present.

Pushed, thanks.

regards, tom lane