Re: race condition in pg_class

From: Noah Misch <noah(at)leadboat(dot)com>
To: Alexander Lakhin <exclusion(at)gmail(dot)com>
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>, pgsql-hackers(at)postgresql(dot)org, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Smolkin Grigory <smallkeen(at)gmail(dot)com>, Michael Paquier <michael(at)paquier(dot)xyz>
Subject: Re: race condition in pg_class
Date: 2024-07-04 22:08:16
Message-ID: 20240704220816.51.nmisch@google.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Jul 04, 2024 at 08:00:00AM +0300, Alexander Lakhin wrote:
> 28.06.2024 08:13, Noah Misch wrote:
> > Pushed. ...
>
> Please look also at another anomaly, I've discovered.
>
> An Assert added with d5f788b41 may be falsified with:
> CREATE TABLE t(a int PRIMARY KEY);
> INSERT INTO t VALUES (1);
> CREATE VIEW v AS SELECT * FROM t;
>
> MERGE INTO v USING (VALUES (1)) AS va(a) ON v.a = va.a
>   WHEN MATCHED THEN DO NOTHING
>   WHEN NOT MATCHED THEN DO NOTHING;
>
> TRAP: failed Assert("resultRelInfo->ri_TrigDesc"), File: "nodeModifyTable.c", Line: 2891, PID: 1590670

Thanks. When all the MERGE actions are DO NOTHING, view_has_instead_trigger()
returns true, so we use the wholerow code regardless of the view's triggers or
auto update capability. The behavior is fine, so I'm fixing the new assertion
and comments with new patch inplace087-merge-DO-NOTHING-v8.patch. The closest
relevant tests processed zero rows, so they narrowly avoided witnessing this
assertion.

Attachment Content-Type Size
inplace085-CCI-analyze-v8.patch text/plain 4.8 KB
inplace087-merge-DO-NOTHING-v8.patch text/plain 7.8 KB
inplace090-LOCKTAG_TUPLE-eoxact-v8.patch text/plain 1.2 KB
inplace110-successors-v8.patch text/plain 44.7 KB
inplace120-locktag-v8.patch text/plain 43.2 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2024-07-04 23:18:33 Re: pgsql: Add pg_get_acl() to get the ACL for a database object
Previous Message Andres Freund 2024-07-04 21:51:40 Re: Wrong results with grouping sets