Re: [HACKERS] proposal psql \gdesc

Поиск
Список
Период
Сортировка
От Peter Eisentraut
Тема Re: [HACKERS] proposal psql \gdesc
Дата
Msg-id a8d15f19-39c2-3bb5-4bd2-79e3d0d4b69e@2ndquadrant.com
обсуждение исходный текст
Ответ на Re: [HACKERS] proposal psql \gdesc  (Pavel Stehule <pavel.stehule@gmail.com>)
Ответы Re: [HACKERS] proposal psql \gdesc  (Pavel Stehule <pavel.stehule@gmail.com>)
Список pgsql-hackers
On 5/3/17 02:56, Pavel Stehule wrote:
>     Sometimes I have to solve the result types of some query. It is
>     invisible in psql. You have to materialize table or you have to
>     create view. Now, when we can enhance \g command, we can introduce
>     query describing
> 
>     some like
> 
>     select a, b from foo
>     \gdesc
> 
>          |   type     | length | collation | ....
>     ------------------------------------------------
>      a  | varchar  |     30  |
>      b  | numeric |      20 | 
> 
> 
> here is the patch. It is based on PQdescribePrepared result.

I have often wished for functionality like this, so I'm in favor of
investigating this.

I don't think you need a separate call to prepare the query.  You can
get the result column types using PQftype().  (Hmm, you can get the
typmod that way, but not the collation.)

My thinking in the past has been to put the column types either in the
column headers, like "colname (coltype)", or in the footer, along with
the actual query result.

-- 
Peter Eisentraut              http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services



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

Предыдущее
От: "David G. Johnston"
Дата:
Сообщение: Re: [HACKERS] CTE inlining
Следующее
От: Tom Lane
Дата:
Сообщение: Re: [HACKERS] idea: custom log_line_prefix components besides application_name