Re: Avoid orphaned objects dependencies, take 3

From: Jeff Davis <pgsql(at)j-davis(dot)com>
To: Bertrand Drouvot <bertranddrouvot(dot)pg(at)gmail(dot)com>
Cc: Heikki Linnakangas <hlinnaka(at)iki(dot)fi>, Robert Haas <robertmhaas(at)gmail(dot)com>, Roman Eskin <r(dot)eskin(at)arenadata(dot)io>, Michael Paquier <michael(at)paquier(dot)xyz>, Alexander Lakhin <exclusion(at)gmail(dot)com>, pgsql-hackers(at)lists(dot)postgresql(dot)org, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Subject: Re: Avoid orphaned objects dependencies, take 3
Date: 2026-06-16 01:19:19
Message-ID: a9eba27eeceebe751490951f0cf631906d4ffd75.camel@j-davis.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, 2026-06-10 at 15:16 +0000, Bertrand Drouvot wrote:
> PFA a new version of v26, it adds a new test as compared to the v26
> previously
> shared.

I'd like to avoid adding lines to AbortTransaction(). Also, I think it
might miss subtransaction aborts, which could be relevant in complex
cases with SPI.

Can you use a structure like:

ProcessUtility()
{
TrackAclTable *prevTrackAclTable = CurrentTrackAclTable;
/* allocates in CurrentMemoryContext */
CurrentTrackAclTable = NewTrackAclTable();

PG_TRY();
{
... rest of ProcessUtility ...
}
PG_FINALLY();
{
FreeTrackAclTable(CurrentTrackAclTable);
CurrentTrackAclTable = prevTrackAclTable;
}
PG_END_TRY();
}

That would avoid the need to create a special memory context; you could
just repalloc() the chunk allocated for the table. It would also mean
you don't have to track the stack frames manually with a counter, just
use a local variable.

Also, are you sure that the two call sites for aclcheck_track_record()
are enough? Or do we need checks in e.g. pg_attribute_aclcheck() as
well?

Regards,
Jeff Davis

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Smith 2026-06-16 01:21:51 Re: Support EXCEPT for TABLES IN SCHEMA publications
Previous Message Peter Smith 2026-06-15 23:49:10 Re: Proposal: Conflict log history table for Logical Replication