/usr/share/postgresql/9.6/extension/ip4r--2.0--2.1.sql is in postgresql-9.6-ip4r 2.1.1-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 | /* ip4r--2.0--2.1.sql */
-- complain if script is sourced in psql, rather than via ALTER EXTENSION
\echo Use "ALTER EXTENSION ip4r UPDATE TO '2.1'" to load this file. \quit
-- ugh. no ALTER CAST
UPDATE pg_catalog.pg_cast SET castcontext = 'a'
WHERE (castsource,casttarget) IN (
('ipaddress'::regtype, 'ip4'::regtype),
('ipaddress'::regtype, 'ip6'::regtype),
('iprange'::regtype, 'ip4r'::regtype),
('iprange'::regtype, 'ip6r'::regtype));
-- double ugh, to finally fix long-standing issue with function signature
-- of gist consistent functions
WITH v(gname,gtype) AS (
VALUES ('gip4r_consistent'::name, 'ip4r'::regtype),
('gip6r_consistent'::name, 'ip6r'::regtype),
('gipr_consistent'::name, 'iprange'::regtype))
UPDATE pg_catalog.pg_proc
SET proargtypes = array_to_string(array['internal',
v.gtype,
'int2',
'oid',
'internal']::regtype[]::oid[],
' ')::pg_catalog.oidvector
FROM v
WHERE proname = v.gname
AND probin = 'MODULE_PATHNAME';
-- actual new stuff
CREATE FUNCTION gip4r_fetch(internal) RETURNS internal AS 'MODULE_PATHNAME' LANGUAGE C;
CREATE FUNCTION gip6r_fetch(internal) RETURNS internal AS 'MODULE_PATHNAME' LANGUAGE C;
CREATE FUNCTION gipr_fetch(internal) RETURNS internal AS 'MODULE_PATHNAME' LANGUAGE C;
DO $s$
BEGIN
IF current_setting('server_version_num')::integer >= 90500 THEN
ALTER OPERATOR FAMILY gist_ip4r_ops USING gist ADD
FUNCTION 9 (ip4r,ip4r) gip4r_fetch (internal);
ALTER OPERATOR FAMILY gist_ip6r_ops USING gist ADD
FUNCTION 9 (ip6r,ip6r) gip6r_fetch (internal);
ALTER OPERATOR FAMILY gist_iprange_ops USING gist ADD
FUNCTION 9 (iprange,iprange) gipr_fetch (internal);
END IF;
IF current_setting('server_version_num')::integer >= 90600 THEN
DECLARE
r record;
BEGIN
FOR r IN SELECT oid::regprocedure as fsig
FROM pg_catalog.pg_proc
WHERE (probin = 'MODULE_PATHNAME'
AND prolang = (SELECT oid FROM pg_catalog.pg_language l WHERE l.lanname='c'))
OR (oid in ('family(ip4)'::regprocedure,
'family(ip6)'::regprocedure,
'family(ip4r)'::regprocedure,
'family(ip6r)'::regprocedure))
LOOP
EXECUTE format('ALTER FUNCTION %s PARALLEL SAFE', r.fsig);
END LOOP;
END;
END IF;
END;
$s$;
-- end
|