Re: [GENERAL] How to stop array_to_json from interpolating column names that weren't there - Mailing list pgsql-general

From Tom Lane
Subject Re: [GENERAL] How to stop array_to_json from interpolating column names that weren't there
Date
Msg-id 13756.1500519715@sss.pgh.pa.us
Whole thread Raw
In response to [GENERAL] How to stop array_to_json from interpolating column names thatweren't there  (Guyren Howe <guyren@gmail.com>)
List 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 by date:

Previous
From: Glen Huang
Date:
Subject: Re: [GENERAL] Is it possible to define a constraint based on thevalues in other rows in the current table?
Next
From: Igor Korot
Date:
Subject: Re: [GENERAL]