Re: Allow GiST opcalsses without compress\decompres functions

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Andrey Borodin <x4mmm(at)yandex-team(dot)ru>
Cc: Alexander Korotkov <a(dot)korotkov(at)postgrespro(dot)ru>, Dmitriy Sarafannikov <dsarafannikov(at)yandex(dot)ru>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Allow GiST opcalsses without compress\decompres functions
Date: 2017-10-22 16:21:44
Message-ID: 12803.1508689304@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Andrey Borodin <x4mmm(at)yandex-team(dot)ru> writes:
> I was looking for a way to correctly drop compress\decompress functions from opclasses.

Making a new opclass seems like a pretty grotty answer; it won't
help existing installations.

I think what you need is to undo opclasscmds.c's decision that the
dependencies should be INTERNAL. I tried this:

regression=# ALTER OPERATOR FAMILY gist_seg_ops USING gist drop function 3 (seg);
ERROR: cannot drop function 3 (seg, seg) of operator family gist_seg_ops for access method gist: gseg_compress(internal) because operator class gist_seg_ops for access method gist requires it

regression=# update pg_depend set deptype = 'a' where classid = 'pg_amproc'::regclass and objid = (select objid from pg_depend where classid = 'pg_amproc'::regclass and refclassid = 'pg_proc'::regclass and refobjid = 'gseg_compress(internal)'::regprocedure) and refclassid = 'pg_opclass'::regclass and deptype = 'i';
UPDATE 1
regression=# ALTER OPERATOR FAMILY gist_seg_ops USING gist drop function 3 (seg);
ALTER OPERATOR FAMILY

For safety, that update requires a bunch more pg_catalog
schema-qualification than I bothered with, but you get the idea.

I'm not sure if needing this hack indicates that we need more ALTER
OPERATOR CLASS/FAMILY syntax to provide a less hacky way of solving
the problem. The idea of removing core entries of an opclass has
never come up before, and I'm not sure it would ever come up again.
If we come across another use-case maybe then would be the time to
fix it more cleanly.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andrew Dunstan 2017-10-22 16:44:58 Re: [BUGS] BUG #14849: jsonb_build_object doesn't like VARIADIC calls very much
Previous Message Andrew Dunstan 2017-10-22 16:11:04 Re: BUG #14849: jsonb_build_object doesn't like VARIADIC calls very much