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 13756.1500519715@sss.pgh.pa.us
обсуждение исходный текст
Ответ на [GENERAL] How to stop array_to_json from interpolating column names thatweren't there  (Guyren Howe <guyren@gmail.com>)
Список pgsql-general
Guyren Howe <guyren@gmail.com> writes:
> I have an array of perfect JSON objects. Now I just need to turn that into a single JSON object. But when I do the
obvious:

> SELECT array_to_json(
>         SELECT
>             ARRAY_AGG(foo) AS foos
>         FROM (
>             SELECT
>                 row_to_json(schemata_)
>             FROM
>                 schemata_)
>             AS
>                 foo
> )

> I get a syntax error.

Well, yeah, you're missing parentheses around the scalar sub-select.
(Whether fixing that will give the behavior you want is unclear,
but the syntax error is clear.)

            regards, tom lane


В списке pgsql-general по дате отправления:

Предыдущее
От: Glen Huang
Дата:
Сообщение: Re: [GENERAL] Is it possible to define a constraint based on thevalues in other rows in the current table?
Следующее
От: Igor Korot
Дата:
Сообщение: Re: [GENERAL]