Re: CREATE ASSERTION: database level assertions feature - Mailing list pgsql-hackers

From Joe Wildish
Subject Re: CREATE ASSERTION: database level assertions feature
Date
Msg-id 3232abf3-3b6b-b56c-5aa5-56f6d82f3e94@lateraljoin.com
Whole thread Raw
In response to Re: CREATE ASSERTION: database level assertions feature  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
On Sat, 14 Feb 2026, Tom Lane wrote:

> Marcos Magueta <maguetamarcos@gmail.com> writes:
>> I would be willing to at least get started with a patch for this, but
>> before that, I want to assess the interest and thoughts on how to properly
>> implement it.
>
> Everyone who has looked at that has run away screaming.  The
> consequences for performance, complexity, deadlock potential,
> etc are all horrible.  There are also fun questions about
> appropriate permissions.  As the spec is written, it appears
> that anyone with read permission on a table can block updates
> on that table (by creating an assertion that attempted updates
> will fail).

Oracle have introduced a new type of permission to cater for that oddity.  I
can't actually remember how their permission system hangs together with respect
to schema ownership, but they allow a schema-level declaration to say whether or
not the owner of schema X can create an assertion about objects in schema Y
(this was gleaned from watching one of their dev videos on this topic).

It strikes me that that might not be granular enough, and you could perhaps
instead allow assertions to be created for only those expressions whose re-check
circumstances match you own mutation rights (as per my other reply on this
thread), but that's probably academic at this point.  An alternative would be a
whole set of other permissions too, I guess.

Cheers,
-Joe



pgsql-hackers by date:

Previous
From: Tomas Vondra
Date:
Subject: Re: index prefetching
Next
From: Tomas Vondra
Date:
Subject: Re: index prefetching