Search Postgresql Archives

Re: Inconsistent behavior with unnamed columns

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

 



David Johnston <polobo@xxxxxxxxx> writes:
> Moshe Jacobson wrote
>> Why does bool get special treatment?
>> 
>> postgres# select 'abc', 1, false;
>> ?column? | ?column? | bool
>> ----------+----------+------
>> abc      |        1 | f
>> (1 row)

> It doesn't (at least not as I see things in my client/version - noted
> below):

> *SELECT 'abc'::text;*

> If the type is known the type is used for the column header but since 'abc'
> and 1 do not have types this does not work.

A look into gram.y shows that "false" is parsed as 'f'::bool, so the
default column header name comes from that cast.  See also FigureColname()
in parser/parse_target.c, which embodies the heuristics for choosing a
default column name for an expression.

			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