Skip to content

feat: do not enable pgjwt by default in pg 15 #1592

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
May 17, 2025
Merged
Show file tree
Hide file tree
Changes from 4 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
6 changes: 5 additions & 1 deletion ansible/tasks/stage2-setup-postgres.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@
- name: Check if psql_version is psql_17
set_fact:
is_psql_17: "{{ psql_version in ['psql_17'] }}"

- name: Check if psql_version is psql_15
set_fact:
is_psql_15: "{{ psql_version in ['psql_15'] }}"

- name: Remove specified extensions from postgresql.conf if orioledb-17 or 17 build
ansible.builtin.command:
Expand All @@ -25,7 +29,7 @@
- name: Remove specified extensions from supautils.conf if orioledb-17 or 17 build
ansible.builtin.command:
cmd: >
sed -i 's/ timescaledb,//g; s/ plv8,//g; s/ pgjwt,//g'
sed -i 's/ timescaledb,//g; s/ plv8,//g'
/etc/postgresql-custom/supautils.conf
when: is_psql_oriole or is_psql_17 and stage2_nix
become: yes
Expand Down
6 changes: 3 additions & 3 deletions ansible/vars.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ postgres_major:

# Full version strings for each major version
postgres_release:
postgresorioledb-17: "17.0.1.080-orioledb"
postgres17: "17.4.1.030"
postgres15: "15.8.1.087"
postgresorioledb-17: "17.0.1.078-orioledb-pgjwt15-2"
postgres17: "17.4.1.028-pgjwt15-2"
postgres15: "15.8.1.085-pgjwt15-2"

# Non Postgres Extensions
pgbouncer_release: "1.19.0"
Expand Down
10 changes: 0 additions & 10 deletions migrations/db/init-scripts/00000000000000-initial-schema.sql
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,6 @@ grant pg_read_all_data to supabase_read_only_user;
create schema if not exists extensions;
create extension if not exists "uuid-ossp" with schema extensions;
create extension if not exists pgcrypto with schema extensions;
do $$
begin
if exists (select 1 from pg_available_extensions where name = 'pgjwt') then
if not exists (select 1 from pg_extension where extname = 'pgjwt') then
if current_setting('server_version_num')::int / 10000 = 15 then
create extension if not exists pgjwt with schema "extensions" cascade;
end if;
end if;
end if;
end $$;


-- Set up auth roles for the developer
Expand Down
14 changes: 0 additions & 14 deletions migrations/schema-15.sql
Original file line number Diff line number Diff line change
Expand Up @@ -114,20 +114,6 @@ CREATE EXTENSION IF NOT EXISTS pgcrypto WITH SCHEMA extensions;
COMMENT ON EXTENSION pgcrypto IS 'cryptographic functions';


--
-- Name: pgjwt; Type: EXTENSION; Schema: -; Owner: -
--

CREATE EXTENSION IF NOT EXISTS pgjwt WITH SCHEMA extensions;


--
-- Name: EXTENSION pgjwt; Type: COMMENT; Schema: -; Owner: -
--

COMMENT ON EXTENSION pgjwt IS 'JSON Web Token API for Postgresql';


--
-- Name: supabase_vault; Type: EXTENSION; Schema: -; Owner: -
--
Expand Down
14 changes: 4 additions & 10 deletions nix/tests/expected/z_15_ext_interface.out

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions nix/tests/expected/z_15_pgjwt.out
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
-- Install pgjwt in extensions schema
CREATE EXTENSION IF NOT EXISTS pgjwt WITH SCHEMA extensions;
-- Set search path to include extensions schema
SET search_path TO extensions, public;
select
sign(
payload := '{"sub":"1234567890","name":"John Doe","iat":1516239022}',
Expand Down
10 changes: 0 additions & 10 deletions nix/tests/prime.sql
Original file line number Diff line number Diff line change
Expand Up @@ -57,16 +57,6 @@ create extension if not exists pg_walinspect;
create extension if not exists pgaudit;
create extension if not exists pgcrypto;
create extension if not exists pgtap;
do $$
begin
if exists (select 1 from pg_available_extensions where name = 'pgjwt') then
if not exists (select 1 from pg_extension where extname = 'pgjwt') then
if current_setting('server_version_num')::int / 10000 = 15 then
create extension if not exists pgjwt;
end if;
end if;
end if;
end $$;
create extension if not exists pgroonga;
create extension if not exists pgroonga_database;
create extension if not exists pgsodium;
Expand Down
6 changes: 6 additions & 0 deletions nix/tests/sql/z_15_pgjwt.sql
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
-- Install pgjwt in extensions schema
CREATE EXTENSION IF NOT EXISTS pgjwt WITH SCHEMA extensions;

-- Set search path to include extensions schema
SET search_path TO extensions, public;

select
sign(
payload := '{"sub":"1234567890","name":"John Doe","iat":1516239022}',
Expand Down
3 changes: 1 addition & 2 deletions nix/tools/run-server.sh.in
Original file line number Diff line number Diff line change
Expand Up @@ -267,13 +267,12 @@ orioledb_config_items() {
echo "non-macos pg 17 conf"
sed -i 's/ timescaledb,//g;' "$DATDIR/postgresql.conf"
sed -i 's/db_user_namespace = off/#db_user_namespace = off/g;' "$DATDIR/postgresql.conf"
sed -i 's/ timescaledb,//g; s/ plv8,//g; s/ pgjwt,//g;' "$DATDIR/supautils.conf"
sed -i 's/ timescaledb,//g; s/ plv8,//g;' "$DATDIR/supautils.conf"
elif [[ "$VERSION" == "17" && "$CURRENT_SYSTEM" = "aarch64-darwin" ]]; then
perl -pi -e 's/db_user_namespace = off/#db_user_namespace = off/g;' "$DATDIR/postgresql.conf"
perl -pi -e 's/ timescaledb,//g' "$DATDIR/postgresql.conf"
perl -pi -e 's/ timescaledb,//g' "$DATDIR/supautils.conf"
perl -pi -e 's/ plv8,//g;' "$DATDIR/supautils.conf"
perl -pi -e 's/ pgjwt,//g;' "$DATDIR/supautils.conf"
fi
}

Expand Down
Loading