Re: Dangling operator family after DROP TYPE
Peter Geoghegan <pg@bowt.ie>
From: Peter Geoghegan <pg@bowt.ie>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Yoran Heling <contact@yorhel.nl>, pgsql-bugs@lists.postgresql.org
Date: 2024-12-06T18:36:27Z
Lists: pgsql-bugs
On Fri, Dec 6, 2024 at 12:15 PM Tom Lane <tgl@sss.pgh.pa.us> wrote:
> Thanks for the report. I don't think it's wrong for the now-empty
> operator family to stick around: it has no direct dependency on the
> dropped type. Also, trying to make it go away would cause problems
> if another operator class for another type had been added to the
> family meanwhile. However, these things are bad:
>
> > Attempting to drop this operator family results in an error. Attempting
> > to do a dump/restore results in a syntax error on restore.
Agreed.
> It's intentional according to the code: in nbtvalidate.c
> we have
>
> if (op->is_func && op->number != BTORDER_PROC)
> {
> /* Optional support proc, so always a soft family dependency */
> op->ref_is_hard = false;
> op->ref_is_family = true;
> op->refobjid = opfamilyoid;
> }
>
> But I think we copied that pattern from other index AMs without
> thinking too hard about it.
That is accurate.
> Peter, any thoughts about this?
Nothing much to say about it.
I would just point out that using the built-in allequalimage function
is specifically documented as bad practice. After all, you as an
individual non-core opclass author don't have any control over its
behavior. At the same time, I do understand the temptation to use the
built-in allequalimage function. In practice most individual B-Tree
opclasses are *obviously* deduplication-safe, and it's convenient to
have a trivial function for that.
--
Peter Geoghegan
Commits
-
Ensure that pg_amop/amproc entries depend on their lefttype/righttype.
- ec7b89cc533a 17.3 landed
- be5db08ed341 16.7 landed
- 725d9810287f 13.19 landed
- 3f9b96217667 18.0 landed
- 1a34cf0f485b 14.16 landed
- 0e4fa06ba55e 15.11 landed
-
Make getObjectDescription robust against dangling amproc type links.
- faad0183507b 16.7 landed
- d9d5e1b48e0d 14.16 landed
- d401914679de 15.11 landed
- c82003760d74 18.0 landed
- 5b44a317ae03 17.3 landed
- 531cbd8b74a5 13.19 landed