-
-
Notifications
You must be signed in to change notification settings - Fork 169
/
Copy pathz_15_ext_interface.sql
122 lines (100 loc) · 3.01 KB
/
z_15_ext_interface.sql
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
/*
The purpose of this test is to monitor the SQL interface exposed
by Postgres extensions so we have to manually review/approve any difference
that emerge as versions change.
*/
/*
List all extensions that are not enabled
If a new entry shows up in this list, that means a new extension has been
added and you should `create extension ...` to enable it in ./nix/tests/prime
*/
create extension if not exists adminpack;
create extension if not exists plv8;
create extension if not exists plcoffee;
create extension if not exists plls;
create extension if not exists old_snapshot;
create extension if not exists timescaledb;
create extension if not exists postgis_tiger_geocoder;
select
name
from
pg_available_extensions
where
installed_version is null
order by
name asc;
/*
Monitor relocatability and config of each extension
- lesson learned from pg_cron
*/
select
extname as extension_name,
extrelocatable as is_relocatable
from
pg_extension
order by
extname asc;
/*
Monitor extension public function interface
*/
select
e.extname as extension_name,
n.nspname as schema_name,
p.proname as function_name,
pg_catalog.pg_get_function_identity_arguments(p.oid) as argument_types,
pg_catalog.pg_get_function_result(p.oid) as return_type
from
pg_catalog.pg_proc p
join pg_catalog.pg_namespace n
on n.oid = p.pronamespace
join pg_catalog.pg_depend d
on d.objid = p.oid
join pg_catalog.pg_extension e
on e.oid = d.refobjid
where
d.deptype = 'e'
-- Filter out changes between pg15 and pg16 from extensions that ship with postgres
-- new in pg16
and not (e.extname = 'fuzzystrmatch' and p.proname = 'daitch_mokotoff')
and not (e.extname = 'pageinspect' and p.proname = 'bt_multi_page_stats')
and not (e.extname = 'pg_buffercache' and p.proname = 'pg_buffercache_summary')
and not (e.extname = 'pg_buffercache' and p.proname = 'pg_buffercache_usage_counts')
and not (e.extname = 'pg_walinspect' and p.proname = 'pg_get_wal_block_info')
-- removed in pg16
and not (e.extname = 'pg_walinspect' and p.proname = 'pg_get_wal_records_info_till_end_of_wal')
and not (e.extname = 'pg_walinspect' and p.proname = 'pg_get_wal_stats_till_end_of_wal')
-- changed in pg16 - output signature added a column
and not (e.extname = 'pageinspect' and p.proname = 'brin_page_items')
order by
e.extname,
n.nspname,
p.proname,
md5(pg_catalog.pg_get_function_identity_arguments(p.oid));
/*
Monitor extension public table/view/matview/index interface
*/
select
e.extname as extension_name,
n.nspname as schema_name,
pc.relname as entity_name,
pa.attname
from
pg_catalog.pg_class pc
join pg_catalog.pg_namespace n
on n.oid = pc.relnamespace
join pg_catalog.pg_depend d
on d.objid = pc.oid
join pg_catalog.pg_extension e
on e.oid = d.refobjid
left join pg_catalog.pg_attribute pa
on pa.attrelid = pc.oid
and pa.attnum > 0
and not pa.attisdropped
where
d.deptype = 'e'
and pc.relkind in ('r', 'v', 'm', 'i')
order by
e.extname,
n.nspname,
pc.relname,
pa.attname;