From: | "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com> |
---|---|
To: | stan <stanb(at)panix(dot)com> |
Cc: | "pgsql-generallists(dot)postgresql(dot)org" <pgsql-general(at)lists(dot)postgresql(dot)org> |
Subject: | Re: Not my day :-( Another syntax error |
Date: | 2019-12-26 17:26:49 |
Message-ID: | CAKFQuwZgmTxFSU94EXc9N6xE5JgSNC3NB7TqSkfjEvz-i+6--Q@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On Thu, Dec 26, 2019 at 9:33 AM stan <stanb(at)panix(dot)com> wrote:
>
> WITH inserted AS (
> INSERT into project_cost_category
> (category)
> VALUES
> ('MISC')
> RETURNING
> *
> )
> SELECT project_cost_category_key
> INTO NEW.project_cost_category_key =
> ( SELECT
> project_cost_category_key
> FROM
> inserted )
>
>
You have two SELECTs. The "inner" one has a FROM clause attached to it
providing columns from the "inserted" CTE. The "outer" one doesn't have a
FROM clause and so doesn't have access to columns. The "outer" SELECT
project_cost_category_key is thus invalid.
David J.
From | Date | Subject | |
---|---|---|---|
Next Message | stan | 2019-12-26 17:50:15 | Re: Not my day :-( Another syntax error |
Previous Message | stan | 2019-12-26 16:33:20 | Not my day :-( Another syntax error |