1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-28 23:42:10 +03:00

Add \gdesc psql command.

This command acts somewhat like \g, but instead of executing the query
buffer, it merely prints a description of the columns that the query
result would have.  (Of course, this still requires parsing the query;
if parse analysis fails, you get an error anyway.)  We accomplish this
using an unnamed prepared statement, which should be invisible to psql
users.

Pavel Stehule, reviewed by Fabien Coelho

Discussion: https://postgr.es/m/CAFj8pRBhYVvO34FU=EKb=nAF5t3b++krKt1FneCmR0kuF5m-QA@mail.gmail.com
This commit is contained in:
Tom Lane
2017-09-05 18:17:47 -04:00
parent 6e427aa4e5
commit 49ca462eb1
8 changed files with 293 additions and 6 deletions

View File

@ -1949,6 +1949,25 @@ Tue Oct 26 21:40:57 CEST 1999
</varlistentry>
<varlistentry>
<term><literal>\gdesc</literal></term>
<listitem>
<para>
Shows the description (that is, the column names and data types)
of the result of the current query buffer. The query is not
actually executed; however, if it contains some type of syntax
error, that error will be reported in the normal way.
</para>
<para>
If the current query buffer is empty, the most recently sent query
is described instead.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><literal>\gexec</literal></term>