Re: Not my day :-( Another syntax error

Поиск
Список
Период
Сортировка
От David G. Johnston
Тема Re: Not my day :-( Another syntax error
Дата
Msg-id CAKFQuwZgmTxFSU94EXc9N6xE5JgSNC3NB7TqSkfjEvz-i+6--Q@mail.gmail.com
обсуждение исходный текст
Ответ на Not my day :-( Another syntax error  (stan <stanb@panix.com>)
Список pgsql-general
On Thu, Dec 26, 2019 at 9:33 AM stan <stanb@panix.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.

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

Предыдущее
От: stan
Дата:
Сообщение: Not my day :-( Another syntax error
Следующее
От: stan
Дата:
Сообщение: Re: Not my day :-( Another syntax error