Re: [GENERAL] How to stop array_to_json from interpolating column names that weren't there
От
Tom Lane
Тема
Re: [GENERAL] How to stop array_to_json from interpolating column names that weren't there
Дата
Msg-id
6659.1500557630@sss.pgh.pa.us
Ответ на
Re: [GENERAL] How to stop array_to_json from interpolating columnnames that weren't there (David G. Johnston)
Список
Дерево обсуждения
[GENERAL] How to stop array_to_json from interpolating column names thatweren't there Guyren Howe <guyren@gmail.com>
Re: [GENERAL] How to stop array_to_json from interpolating column names that weren't there Tom Lane <tgl@sss.pgh.pa.us>
Re: [GENERAL] How to stop array_to_json from interpolating columnnames that weren't there Paul Jungwirth <pj@illuminatedcomputing.com>
Re: [GENERAL] How to stop array_to_json from interpolating columnnames that weren't there Guyren Howe <guyren@gmail.com>
Re: [GENERAL] How to stop array_to_json from interpolating columnnames that weren't there "David G. Johnston" <david.g.johnston@gmail.com>
Re: [GENERAL] How to stop array_to_json from interpolating column names that weren't there Tom Lane <tgl@sss.pgh.pa.us>
"David G. Johnston" writes: > On Wed, Jul 19, 2017 at 8:53 PM, Guyren Howe wrote: >> Thanks. Seeking greater understanding, why is json_agg(*) not equivalent? > Are you referring to the fact that this provokes an error? > "select json_agg(*) from schemata;" The reason for that is that we interpret foo(*) as a call to a zero-argument aggregate, in order to satisfy the spec's insistence that "count(*)" is the way to invoke the argument-free form of count(). But there's no zero-argument function named json_agg(). I think David's answer was based on interpreting the command as select json_agg(schemata.*) from schemata; but that's something entirely different: it results in passing a single composite-type argument to the function. Yet again different is use of * at top level of a SELECT list. SQL is not the most consistent language in the world to begin with, and some of these notations are things we inherited from Berkeley PostQUEL and didn't want to give up, so it's a bit of a mess :-( regards, tom lane
В списке pgsql-general по дате отправления