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