Re: Show type in psql SELECT - Mailing list pgsql-hackers

From Craig Ringer
Subject Re: Show type in psql SELECT
Date
Msg-id 512AA6C5.4000404@2ndquadrant.com
Whole thread Raw
In response to Re: Show type in psql SELECT  (Peter Eisentraut <peter_e@gmx.net>)
Responses Re: Show type in psql SELECT  (Mike Toews <mwtoews@gmail.com>)
List pgsql-hackers
On 02/25/2013 07:14 AM, Peter Eisentraut wrote:
> On Sat, 2013-02-23 at 12:09 +1300, Mike Toews wrote:
>> Has anyone else thought this was a missing feature?
> I have.
As have I, repeatedly. This would be a nice convenience, though
pg_typeof can be used to achieve a similar effect a bit more clumsily.

However, the thing I want most couldn't be provided by this patch
because it seems to be a deeper server limitation: the ability to get
typmod data from calculation results like
   NUMERIC(8,3) '11.131' + NUMERIC(8,3) '12.123'

The ability to get types for select results is already available, it's
just a bit clumsier:
   select pg_typeof('134'), pg_typeof(1234);

It can't report typmods for calculation results. Can your proposed
change? See eg:

regress=> select pg_typeof(NUMERIC(8,3) '11.131'),
pg_typeof(NUMERIC(8,3) '12.123'), pg_typeof(NUMERIC(8,3) '11.131' +
NUMERIC(8,3) '12.123');pg_typeof | pg_typeof | pg_typeof
-----------+-----------+-----------numeric   | numeric   | numeric
(1 row)

-- Craig Ringer                   http://www.2ndQuadrant.com/PostgreSQL Development, 24x7 Support, Training & Services




pgsql-hackers by date:

Previous
From: Craig Ringer
Date:
Subject: Re: json generation enhancements
Next
From: Andrew Dunstan
Date:
Subject: Re: json generation enhancements