Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,41 @@ do $$
declare
extoid oid := (select oid from pg_extension where extname = 'pgmq');
r record;
cls pg_class%rowtype;
begin

set local search_path = '';
update pg_extension set extowner = 'postgres'::regrole where extname = 'pgmq';

for r in (select * from pg_depend where refobjid = extoid) loop


if r.classid = 'pg_type'::regclass then
execute(format('alter type %s owner to postgres;', r.objid::regtype));

-- store the type's relkind
select * into cls from pg_class c where c.reltype = r.objid;

if r.objid::regtype::text like '%[]' then
-- do nothing (skipping array type)

elsif cls.relkind in ('r', 'p', 'f', 'm') then
-- table-like objects (regular table, partitioned, foreign, materialized view)
execute format('alter table pgmq.%I owner to postgres;', cls.relname);

else
execute(format('alter type %s owner to postgres;', r.objid::regtype));

end if;

elsif r.classid = 'pg_proc'::regclass then
execute(format('alter function %s(%s) owner to postgres;', r.objid::regproc, pg_get_function_identity_arguments(r.objid)));

elsif r.classid = 'pg_class'::regclass then
execute(format('alter table %s owner to postgres;', r.objid::regclass));

else
raise exception 'error on pgmq after-create script: unexpected object type %', r.classid;

end if;
end loop;
end $$;
6 changes: 1 addition & 5 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -147,11 +147,7 @@
x:
x != ./nix/ext/timescaledb.nix &&
x != ./nix/ext/timescaledb-2.9.1.nix &&
x != ./nix/ext/plv8.nix &&
x != ./nix/ext/postgis.nix &&
x != ./nix/ext/pgrouting.nix &&
x != ./nix/ext/pg_jsonschema.nix &&
x != ./nix/ext/pg_graphql.nix
x != ./nix/ext/plv8.nix
) ourExtensions;

orioledbExtensions = orioleFilteredExtensions ++ [ ./nix/ext/orioledb.nix ];
Expand Down
13 changes: 7 additions & 6 deletions nix/tests/expected/pg_tle.out
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
set client_min_messages = warning;
select
pgtle.install_extension(
'pg_distance',
Expand Down Expand Up @@ -29,16 +30,16 @@ select
(1 row)

create extension pg_distance;
select manhattan_dist(1, 1, 5, 5);
select manhattan_dist(1, 1, 5, 5)::numeric(10,2);
manhattan_dist
----------------
8
8.00
(1 row)

select euclidean_dist(1, 1, 5, 5);
euclidean_dist
-------------------
5.656854249492381
select euclidean_dist(1, 1, 5, 5)::numeric(10,2);
euclidean_dist
----------------
5.66
(1 row)

SELECT pgtle.install_update_path(
Expand Down

Large diffs are not rendered by default.

File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
/*
This test is excluded from the Postgres 17 suite because it does not ship
with the Supabase PG17 image
*/
create extension if not exists plv8;
NOTICE: extension "plv8" already exists, skipping
create schema v;
-- create a function to perform some JavaScript operations
create function v.multiply_numbers(a integer, b integer)
Expand Down
15 changes: 9 additions & 6 deletions nix/tests/expected/rum.out → nix/tests/expected/z_15_rum.out
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
/*
This extension is excluded from oriole-17 because it uses an unsupported index type
*/
create schema v;
create table v.test_rum(
t text,
Expand All @@ -20,18 +23,18 @@ values
create index rumidx on v.test_rum using rum (a rum_tsvector_ops);
select
t,
a <=> to_tsquery('english', 'beautiful | place') as rank
round(a <=> to_tsquery('english', 'beautiful | place')) as rank
from
v.test_rum
where
a @@ to_tsquery('english', 'beautiful | place')
order by
a <=> to_tsquery('english', 'beautiful | place');
t | rank
---------------------------------+----------
it looks like a beautiful place | 8.22467
the situation is most beautiful | 16.44934
it is a beautiful | 16.44934
t | rank
---------------------------------+------
it looks like a beautiful place | 8
the situation is most beautiful | 16
it is a beautiful | 16
(3 rows)

drop schema v cascade;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
/*
This test is excluded from the Postgres 17 suite because it does not ship
with the Supabase PG17 image
*/
create extension if not exists timescaledb;
NOTICE: extension "timescaledb" already exists, skipping
-- Confirm we're running the apache version
show timescaledb.license;
timescaledb.license
Expand Down
5,324 changes: 5,324 additions & 0 deletions nix/tests/expected/z_17_ext_interface.out

Large diffs are not rendered by default.

10 changes: 10 additions & 0 deletions nix/tests/expected/z_17_pg_stat_monitor.out
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
select
*
from
pg_stat_monitor
where
false;
bucket | bucket_start_time | userid | username | dbid | datname | client_ip | pgsm_query_id | queryid | toplevel | top_queryid | query | comments | planid | query_plan | top_query | application_name | relations | cmd_type | cmd_type_text | elevel | sqlcode | message | calls | total_exec_time | min_exec_time | max_exec_time | mean_exec_time | stddev_exec_time | rows | shared_blks_hit | shared_blks_read | shared_blks_dirtied | shared_blks_written | local_blks_hit | local_blks_read | local_blks_dirtied | local_blks_written | temp_blks_read | temp_blks_written | shared_blk_read_time | shared_blk_write_time | local_blk_read_time | local_blk_write_time | temp_blk_read_time | temp_blk_write_time | resp_calls | cpu_user_time | cpu_sys_time | wal_records | wal_fpi | wal_bytes | bucket_done | plans | total_plan_time | min_plan_time | max_plan_time | mean_plan_time | stddev_plan_time | jit_functions | jit_generation_time | jit_inlining_count | jit_inlining_time | jit_optimization_count | jit_optimization_time | jit_emission_count | jit_emission_time | jit_deform_count | jit_deform_time | stats_since | minmax_stats_since
--------+-------------------+--------+----------+------+---------+-----------+---------------+---------+----------+-------------+-------+----------+--------+------------+-----------+------------------+-----------+----------+---------------+--------+---------+---------+-------+-----------------+---------------+---------------+----------------+------------------+------+-----------------+------------------+---------------------+---------------------+----------------+-----------------+--------------------+--------------------+----------------+-------------------+----------------------+-----------------------+---------------------+----------------------+--------------------+---------------------+------------+---------------+--------------+-------------+---------+-----------+-------------+-------+-----------------+---------------+---------------+----------------+------------------+---------------+---------------------+--------------------+-------------------+------------------------+-----------------------+--------------------+-------------------+------------------+-----------------+-------------+--------------------
(0 rows)

59 changes: 59 additions & 0 deletions nix/tests/expected/z_17_pgvector.out
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
/*
This test excludes indexes shipped with pgvector because orioledb doesn't support them yet
*/
create schema v;
create table v.items(
id serial primary key,
embedding vector(3),
half_embedding halfvec(3),
bit_embedding bit(3),
sparse_embedding sparsevec(3)
);
-- Populate some records
insert into v.items(
embedding,
half_embedding,
bit_embedding,
sparse_embedding
)
values
('[1,2,3]', '[1,2,3]', '101', '{1:4}/3'),
('[2,3,4]', '[2,3,4]', '010', '{1:7,3:0}/3');
-- Test op types
select
*
from
v.items
order by
embedding <-> '[2,3,5]',
embedding <=> '[2,3,5]',
embedding <+> '[2,3,5]',
embedding <#> '[2,3,5]',
half_embedding <-> '[2,3,5]',
half_embedding <=> '[2,3,5]',
half_embedding <+> '[2,3,5]',
half_embedding <#> '[2,3,5]',
sparse_embedding <-> '{2:4,3:1}/3',
sparse_embedding <=> '{2:4,3:1}/3',
sparse_embedding <+> '{2:4,3:1}/3',
sparse_embedding <#> '{2:4,3:1}/3',
bit_embedding <~> '011';
id | embedding | half_embedding | bit_embedding | sparse_embedding
----+-----------+----------------+---------------+------------------
2 | [2,3,4] | [2,3,4] | 010 | {1:7}/3
1 | [1,2,3] | [1,2,3] | 101 | {1:4}/3
(2 rows)

select
avg(embedding),
avg(half_embedding)
from
v.items;
avg | avg
---------------+---------------
[1.5,2.5,3.5] | [1.5,2.5,3.5]
(1 row)

-- Cleanup
drop schema v cascade;
NOTICE: drop cascades to table v.items
10 changes: 3 additions & 7 deletions nix/tests/prime.sql
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
-- disable notice messages becuase they differ between 15 and 17
set client_min_messages = warning;

create extension if not exists address_standardizer;
create extension if not exists address_standardizer_data_us;
create extension if not exists adminpack;
create extension if not exists amcheck;
create extension if not exists autoinc;
create extension if not exists bloom;
Expand All @@ -25,7 +27,6 @@ create extension if not exists isn;
create extension if not exists lo;
create extension if not exists ltree;
create extension if not exists moddatetime;
create extension if not exists old_snapshot;
create extension if not exists pageinspect;
create extension if not exists pg_backtrace;
create extension if not exists pg_buffercache;
Expand Down Expand Up @@ -62,13 +63,9 @@ create extension if not exists pgsodium;
create extension if not exists pgrowlocks;
create extension if not exists pgstattuple;
create extension if not exists plpgsql_check;
create extension if not exists plv8;
create extension if not exists plcoffee;
create extension if not exists plls;
create extension if not exists postgis;
create extension if not exists postgis_raster;
create extension if not exists postgis_sfcgal;
create extension if not exists postgis_tiger_geocoder;
create extension if not exists postgis_topology;
create extension if not exists pgrouting; -- requires postgis
create extension if not exists postgres_fdw;
Expand All @@ -79,7 +76,6 @@ create extension if not exists sslinfo;
create extension if not exists supabase_vault;
create extension if not exists tablefunc;
create extension if not exists tcn;
create extension if not exists timescaledb;
create extension if not exists tsm_system_rows;
-- create extension if not exists tsm_system_time; not supported in apache license
create extension if not exists unaccent;
Expand Down
7 changes: 5 additions & 2 deletions nix/tests/sql/pg_tle.sql
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
set client_min_messages = warning;

select
pgtle.install_extension(
'pg_distance',
Expand Down Expand Up @@ -26,8 +28,8 @@ select

create extension pg_distance;

select manhattan_dist(1, 1, 5, 5);
select euclidean_dist(1, 1, 5, 5);
select manhattan_dist(1, 1, 5, 5)::numeric(10,2);
select euclidean_dist(1, 1, 5, 5)::numeric(10,2);

SELECT pgtle.install_update_path(
'pg_distance',
Expand Down Expand Up @@ -67,4 +69,5 @@ select

-- Restore original state if any of the above fails
drop extension pg_tle cascade;

create extension pg_tle;
122 changes: 122 additions & 0 deletions nix/tests/sql/z_15_ext_interface.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,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,
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;
File renamed without changes.
File renamed without changes.
Loading
Loading