Re: [HACKERS] proposal psql \gdesc

Поиск
Список
Период
Сортировка
От Fabien COELHO
Тема Re: [HACKERS] proposal psql \gdesc
Дата
Msg-id alpine.DEB.2.20.1705091721400.29373@lancre
обсуждение исходный текст
Ответ на Re: [HACKERS] proposal psql \gdesc  (Pavel Stehule <pavel.stehule@gmail.com>)
Ответы Re: [HACKERS] proposal psql \gdesc
Список pgsql-hackers
Hello Pavel,

>> Patch applies cleanly and compiles.

Idem for v2. "make check" ok. Tests look good.

>> I would suggest some rewording, maybe:
>>
>> "Show the description of the result of the current query buffer without
>> actually executing it, by considering it a prepared statement."
>>
> done

Ok. If some native English speaker can clarify the sentence further, or 
imprive it anyway, thanks in advance!

>>   SELECT $1 AS unknown_type \gdesc
>
> It is not unknown type - the default placeholder type is text

Indeed. I really meant something like:
  calvin=# SELECT $1 + $2 \gdesc  ERROR:  operator is not unique: unknown + unknown  ...

More comments:

I propose that the help message could be "describe result of query without 
executing it".

I found an issue. \gdesk fails when the command does not return a result:
 calvin=# TRUNCATE pgbench_history \gdesc ERROR:  syntax error at or near ")" LINE 2:  (VALUES ) s (name, tp, tpm)

I guess the issue is that PQdescribePrepared returns an empty description, 
which is fine, but then the second query should be skipped, and some 
message should be output instead, like "no result" or whatever...

This need fixing, and a corresponding test should be added.

Also I would suggest to add a \g after the first test, which would execute 
the current buffer after its description, to show that the current buffer 
does indeed hold the query:
 calvin=# SELECT 1 as one, ... \gdesc \g -- one | int -- ... -- 1 | ...

-- 
Fabien.



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

Предыдущее
От: Petr Jelinek
Дата:
Сообщение: Re: [HACKERS] logical replication syntax (was DROP SUBSCRIPTION,query cancellations and slot handling)
Следующее
От: Petr Jelinek
Дата:
Сообщение: Re: [HACKERS] logical replication deranged sender