Re: CTAS command tags

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Andreas Karlsson <andreas(at)proxel(dot)se>
Cc: Darafei "Komяpa" Praliaskouski <me(at)komzpa(dot)net>, Vik Fearing <vik(at)postgresfriends(dot)org>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: CTAS command tags
Date: 2021-01-22 15:52:54
Message-ID: 1155317.1611330774@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Andreas Karlsson <andreas(at)proxel(dot)se> writes:
> On 1/22/21 2:19 PM, Darafei "Komяpa" Praliaskouski wrote:
>> Having row count right away is very useful in CTAS in analytical and GIS
>> usage scenarios.

> I can see that, but would it not work if it was:
> CREATE TABLE AS 1

Changing the set of command tags that have counts attached would amount
to a wire-protocol break, because clients such as libpq know which ones
do. So to standardize this as Vik wants, we'd have to make the WITH
NO DATA case return "SELECT 0" (not 1, surely). That seems a little
weird.

I have a vague recollection that this has been discussed before,
though I lack the energy to go digging in the archives right now.

regards, tom lane

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Konstantin Knizhnik 2021-01-22 16:04:40 Re: [PoC] Non-volatile WAL buffer
Previous Message Tom Lane 2021-01-22 15:42:33 Re: Add primary keys to system catalogs