PostgreSQL Rule does not work with deferred constraint.

2022-09-21 Thread Louis Tian
transforms the insert statement and executed the rule action in the same transaction. So I think it should work. But I got the same error on both pg13 and pg14. Is there something I missed here? or is my understanding of the rule system just simply wrong? Regards, Louis Tian louis.t...@aquamonix.com.au

Row Level Security Policy Name in Error Message

2023-03-06 Thread Louis Tian
Hi All, Wondering whether there is a way to get the row-level security policy name in the error message when it's violated. I am only getting a more generic error message like this. ERROR: new row violates row-level security policy for table "table_name" Thanks for your help.

UPSERT in Postgres

2023-04-06 Thread Louis Tian
void of the aforementioned limitation. The downside is it is rather verbose. *Question* This there a way to do an upsert proper prior to PG15? *Feature Request* Given that UPSERT is an *idempotent* operator it is extremely useful. Would love to see an UPSERT command in PostgreSQL so one can 'upsert' properly and easily. Regards, Louis Tian

Re: [EXTERNAL]: Re: UPSERT in Postgres

2023-04-08 Thread Louis Tian
table name). Still wish there would be UPSERT statement that can handle this and make dev experience better. Cheers, Louis Tian From: Adrian Klaver Sent: Friday, April 7, 2023 7:00 AM To: Louis Tian ; pgsql-general@lists.postgresql.org Subject: [EXTERNAL]: Re

Re: [EXTERNAL]: Re: UPSERT in Postgres

2023-04-08 Thread Louis Tian
y it primary key). So the update execute without error. I hope the pesudo code above is enough to clarify the difference? > The MERGE command has various race conditions that are particularly > relevant to UPSERT type use cases. See the wiki page you referenced > for a huge amount of inf

Re: [EXTERNAL]: Re: [EXTERNAL]: Re: UPSERT in Postgres

2023-04-09 Thread Louis Tian
From: Israel Brewster Sent: Sunday, April 9, 2023 3:09 AM To: Louis Tian Cc: Peter Geoghegan ; pgsql-general@lists.postgresql.org Subject: [EXTERNAL]: Re: [EXTERNAL]: Re: UPSERT in Postgres Thanks Israel. Your example really helped me to understand where we

Re: [EXTERNAL]: Re: [EXTERNAL]: Re: UPSERT in Postgres

2023-04-09 Thread Louis Tian
uld be in my opinion). It was just a question just to confirm my understanding so I got what I need, so thank you all for that. Cheers, Louis Tian From: Adrian Klaver Sent: Sunday, April 9, 2023 7:51 AM To: Louis Tian ; Peter Geoghegan Cc: pgsql-general@lists.postgresql.org Subject: [EX

RE: [EXTERNAL]: Re: [EXTERNAL]: Re: UPSERT in Postgres

2023-04-09 Thread Louis Tian
t say actual HTTP PUT request is idempotent. With the "current_datetime" and "access_count+1", you are effectively changing the value passing to the UPSERT operator. Just like how you changed the payload of a PUT, then obviously there is no reason to expect the state of th

RE: [EXTERNAL]: Re: [EXTERNAL]: Re: UPSERT in Postgres

2023-04-09 Thread Louis Tian
NFLICT DO UPDATE is not complete equivalent to a TRUE upsert. Cheers, Louis Tian -Original Message- From: Alban Hertroys Sent: Sunday, April 9, 2023 7:26 PM To: Louis Tian Cc: Peter Geoghegan ; pgsql-general@lists.postgresql.org Subject: [EXTERNAL]: Re: [EXTERNAL]: Re: UPSERT in Postgres CAU