Re: RowDescription message

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Tatsuo Ishii <ishii(at)sraoss(dot)co(dot)jp>
Cc: andres(at)anarazel(dot)de, pgsql-general(at)postgresql(dot)org
Subject: Re: RowDescription message
Date: 2019-10-07 13:32:29
Message-ID: 25427.1570455149@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Tatsuo Ishii <ishii(at)sraoss(dot)co(dot)jp> writes:
>>> According to the manualof RowDescription message
>>> https://www.postgresql.org/docs/12/protocol-message-formats.html
>>> Specifies the number of fields in a row (can be zero).
>>> Does 0 fields could actually happen?

>> Yes, e.g.:
>> SELECT;

> Thanks. Is it a valid SQL statement according to the standard?

See select.sgml:

<refsect2>
<title>Empty <literal>SELECT</literal> Lists</title>

<para>
The list of output expressions after <literal>SELECT</literal> can be
empty, producing a zero-column result table.
This is not valid syntax according to the SQL standard.
<productname>PostgreSQL</productname> allows it to be consistent with
allowing zero-column tables.
However, an empty list is not allowed when <literal>DISTINCT</literal> is used.
</para>
</refsect2>

regards, tom lane

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Adrian Klaver 2019-10-07 14:36:48 Re: psql \copy hanging
Previous Message Tatsuo Ishii 2019-10-07 12:52:01 Re: RowDescription message