Search Postgresql Archives

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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



=?UTF-8?B?Ik5pbHMgTy4gU2Vsw6VzZGFsIg==?= <noselasd@xxxxxxxxxxxxxxxxxxxxx> 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

-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux