Re: Can psql show the column type of a result ?

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Can psql show the column type of a result ?
Дата
Msg-id 2587.1285192285@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Can psql show the column type of a result ?  ("Nils O. Selåsdal" <noselasd@asgaard.homelinux.org>)
Список pgsql-general
=?UTF-8?B?Ik5pbHMgTy4gU2Vsw6VzZGFsIg==?= <noselasd@asgaard.homelinux.org> writes:
> I'm wondering if there's a way to show the column type of a result with
> psql, e.g.

>>> select sum(r) from mytable;
>     r
> -------
>   101.0

> I'd like to see the type of the 'r' column.

There's nothing built-in to psql, but you could modify the query, eg

select pg_typeof(sum(r)) from mytable;

(Adding "LIMIT 1" would be wise in most cases, though you don't need it
here.)

            regards, tom lane

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

Предыдущее
От: Richard Broersma
Дата:
Сообщение: Re: Can psql show the column type of a result ?
Следующее
От: Maciek Sakrejda
Дата:
Сообщение: Re: Nested literal parsing rules?