Search Postgresql Archives

Re: Not my day :-( Another syntax error

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Dec 26, 2019 at 9:33 AM stan <stanb@xxxxxxxxx> 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.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]

  Powered by Linux