Debian Codegraph @

contrib/seg/seg--1.2--1.3.sql

raw
1 /* contrib/seg/seg--1.2--1.3.sql */
2
3 -- complain if script is sourced in psql, rather than via ALTER EXTENSION
4 \echo Use "ALTER EXTENSION seg UPDATE TO '1.3'" to load this file. \quit
5
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 being
12 -- bound into a particular opclass. There's no SQL command for that,
13 -- so fake it with a manual update on pg_depend.
14 --
15 DO LANGUAGE plpgsql
16 $$
17 DECLARE
18 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');
20 BEGIN
21 -- for safety, transiently set search_path to just pg_catalog+pg_temp
22 PERFORM pg_catalog.set_config('search_path', 'pg_catalog, pg_temp', true);
23
24 UPDATE pg_catalog.pg_depend
25 SET deptype = 'a'
26 WHERE classid = 'pg_catalog.pg_amproc'::pg_catalog.regclass
27 AND objid =
28 (SELECT objid
29 FROM pg_catalog.pg_depend
30 WHERE classid = 'pg_catalog.pg_amproc'::pg_catalog.regclass
31 AND refclassid = 'pg_catalog.pg_proc'::pg_catalog.regclass
32 AND (refobjid = (my_schema || '.gseg_compress(internal)')::pg_catalog.regprocedure))
33 AND refclassid = 'pg_catalog.pg_opclass'::pg_catalog.regclass
34 AND deptype = 'i';
35
36 UPDATE pg_catalog.pg_depend
37 SET deptype = 'a'
38 WHERE classid = 'pg_catalog.pg_amproc'::pg_catalog.regclass
39 AND objid =
40 (SELECT objid
41 FROM pg_catalog.pg_depend
42 WHERE classid = 'pg_catalog.pg_amproc'::pg_catalog.regclass
43 AND refclassid = 'pg_catalog.pg_proc'::pg_catalog.regclass
44 AND (refobjid = (my_schema || '.gseg_decompress(internal)')::pg_catalog.regprocedure))
45 AND refclassid = 'pg_catalog.pg_opclass'::pg_catalog.regclass
46 AND deptype = 'i';
47
48 PERFORM pg_catalog.set_config('search_path', old_path, true);
49 END
50 $$;
51
52 ALTER OPERATOR FAMILY gist_seg_ops USING gist drop function 3 (seg);
53 ALTER EXTENSION seg DROP function gseg_compress(pg_catalog.internal);
54 DROP function gseg_compress(pg_catalog.internal);
55
56 ALTER OPERATOR FAMILY gist_seg_ops USING gist drop function 4 (seg);
57 ALTER EXTENSION seg DROP function gseg_decompress(pg_catalog.internal);
58 DROP function gseg_decompress(pg_catalog.internal);