Re: Show type in psql SELECT

Поиск
Список
Период
Сортировка
От Craig Ringer
Тема Re: Show type in psql SELECT
Дата
Msg-id 512AA6C5.4000404@2ndquadrant.com
обсуждение исходный текст
Ответ на Re: Show type in psql SELECT  (Peter Eisentraut <peter_e@gmx.net>)
Ответы Re: Show type in psql SELECT  (Mike Toews <mwtoews@gmail.com>)
Список 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 по дате отправления:

Предыдущее
От: Craig Ringer
Дата:
Сообщение: Re: json generation enhancements
Следующее
От: Andrew Dunstan
Дата:
Сообщение: Re: json generation enhancements