codekingpro/portable-devtools
114k
1/* contrib/seg/seg--1.2--1.3.sql */2 3-- complain if script is sourced in psql, rather than via ALTER EXTENSION4\echo Use "ALTER EXTENSION seg UPDATE TO '1.3'" to load this file. \quit5 6--7-- Get rid of unnecessary compress and decompress support functions.8--9-- To be allowed to drop the opclass entry for a support function,10-- we must change the entry's dependency type from 'internal' to 'auto',11-- as though it were a loose member of the opfamily rather than being12-- bound into a particular opclass. There's no SQL command for that,13-- so fake it with a manual update on pg_depend.14--15DO LANGUAGE plpgsql16$$17DECLARE18 my_schema pg_catalog.text := pg_catalog.quote_ident(pg_catalog.current_schema());19 old_path pg_catalog.text := pg_catalog.current_setting('search_path');20BEGIN21-- for safety, transiently set search_path to just pg_catalog+pg_temp22PERFORM pg_catalog.set_config('search_path', 'pg_catalog, pg_temp', true);23 24UPDATE pg_catalog.pg_depend25SET deptype = 'a'26WHERE classid = 'pg_catalog.pg_amproc'::pg_catalog.regclass27 AND objid =28 (SELECT objid29 FROM pg_catalog.pg_depend30 WHERE classid = 'pg_catalog.pg_amproc'::pg_catalog.regclass31 AND refclassid = 'pg_catalog.pg_proc'::pg_catalog.regclass32 AND (refobjid = (my_schema || '.gseg_compress(internal)')::pg_catalog.regprocedure))33 AND refclassid = 'pg_catalog.pg_opclass'::pg_catalog.regclass34 AND deptype = 'i';35 36UPDATE pg_catalog.pg_depend37SET deptype = 'a'38WHERE classid = 'pg_catalog.pg_amproc'::pg_catalog.regclass39 AND objid =40 (SELECT objid41 FROM pg_catalog.pg_depend42 WHERE classid = 'pg_catalog.pg_amproc'::pg_catalog.regclass43 AND refclassid = 'pg_catalog.pg_proc'::pg_catalog.regclass44 AND (refobjid = (my_schema || '.gseg_decompress(internal)')::pg_catalog.regprocedure))45 AND refclassid = 'pg_catalog.pg_opclass'::pg_catalog.regclass46 AND deptype = 'i';47 48PERFORM pg_catalog.set_config('search_path', old_path, true);49END50$$;51 52ALTER OPERATOR FAMILY gist_seg_ops USING gist drop function 3 (seg);53ALTER EXTENSION seg DROP function gseg_compress(pg_catalog.internal);54DROP function gseg_compress(pg_catalog.internal);55 56ALTER OPERATOR FAMILY gist_seg_ops USING gist drop function 4 (seg);57ALTER EXTENSION seg DROP function gseg_decompress(pg_catalog.internal);58DROP function gseg_decompress(pg_catalog.internal);59 