From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | David Johnston <polobo(at)yahoo(dot)com> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: Inconsistent behavior with unnamed columns |
Date: | 2013-09-30 21:33:32 |
Message-ID: | 43044.1380576812@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
David Johnston <polobo(at)yahoo(dot)com> 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
From | Date | Subject | |
---|---|---|---|
Next Message | Ken Tanzer | 2013-09-30 23:23:58 | Re: psql swallowed my "BEGIN;" on reset... user beware? |
Previous Message | David Johnston | 2013-09-30 21:18:31 | Re: Inconsistent behavior with unnamed columns |