Re: Partial update on an postgres upsert violates constraint

From: Kim Rose Carlsen <krc(at)hiper(dot)dk>
To: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>, Andreas Terrius <gotenwinz99(at)gmail(dot)com>, "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: Partial update on an postgres upsert violates constraint
Date: 2016-11-19 19:33:30
Message-ID: AM4PR0501MB261097AEABE315EC1410A623C7B30@AM4PR0501MB2610.eurprd05.prod.outlook.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

> AFAIK, EXCLUDED is only available in a trigger function:

>
> https://www.postgresql.org/docs/9.5/static/trigger-definition.html
>
> You are using EXCLUDED in a regular function so it would not be found.
>
> Can you also show the failure for your alternate method?

From the manual
https://www.postgresql.org/docs/9.5/static/sql-insert.html

"
conflict_action
conflict_action specifies an alternative ON CONFLICT action. It can be either DO NOTHING, or a DO UPDATE clause specifying the exact details of the UPDATE action to be performed in case of a conflict. The SET and WHERE clauses in ON CONFLICT DO UPDATE have access to the existing row using the table's name (or an alias), and to rows proposed for insertion using the special excluded table. SELECT privilege is required on any column in the target table where corresponding excluded columns are read.
"

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Adrian Klaver 2016-11-19 20:48:27 Re: Partial update on an postgres upsert violates constraint
Previous Message Fran ... 2016-11-19 19:12:54 Re: Database migration to RDS issues permissions