From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Neil Conway <neil(dot)conway(at)gmail(dot)com> |
Cc: | pgsql-bugs(at)postgresql(dot)org |
Subject: | Re: row_to_json(), NULL values, and AS |
Date: | 2018-06-15 14:53:13 |
Message-ID: | 32582.1529074393@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs pgsql-hackers |
I wrote:
> Neil Conway <neil(dot)conway(at)gmail(dot)com> writes:
>> The following behavior does not seem self-consistent to me:
> Likewise.
Oh! What is actually happening is
(1) With no explicit alias, the column name of the sub-select's second
output column is chosen to be "row_to_json".
(2) That makes the outer query's notation row_to_json(x) ambiguous: it
could be a function-syntax reference to the column x.row_to_json.
(3) As it happens, the column interpretation is chosen when it's
ambiguous (cf ParseComplexProjection).
I'm a bit hesitant to muck with this behavior, given that it's stood
for ~20 years. However, if we did want to touch it, maybe the right
thing would be to give up the absolutist position that f(x) and x.f
are exactly interchangeable. We could say instead that we prefer the
function interpretation if function syntax is used, and the column
interpretation if column syntax is used. I don't know how likely
that is to break existing apps ... perhaps not very, but I wouldn't
risk back-patching it in any case.
regards, tom lane
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2018-06-15 17:21:07 | Re: BUG #15237: I got "ERROR: source for a multiple-column UPDATE item must be a sub-SELECT or ROW() expression" |
Previous Message | Amit Langote | 2018-06-15 04:06:10 | Re: BUG #15238: Sequence owner not updated when owning table is foreign |
From | Date | Subject | |
---|---|---|---|
Next Message | Charles Cui | 2018-06-15 14:58:32 | Re: [GSoC] current working status |
Previous Message | Amit Kapila | 2018-06-15 14:36:41 | Re: question on streaming replication |