From 608d57981c4e98af896b5a97ae4a8a9eb4409c1c Mon Sep 17 00:00:00 2001 From: samrose Date: Wed, 15 Jan 2025 01:06:13 -0500 Subject: [PATCH] feat: update oriole extension to beta9 (#1407) * feat: update oriole extension to beta9 * chore: testing suffix * chore: rm staging suffix * chore: update pg_regres for changes in oriole sql ext interface * chore: fix test database/dbmate tool to work with new start-server (#1410) --- ansible/vars.yml | 4 +- migrations/schema-orioledb-17.sql | 56 +++++++++-------------- nix/ext/orioledb.nix | 18 +++++--- nix/tests/expected/z_17_ext_interface.out | 7 +-- nix/tools/dbmate-tool.sh.in | 2 +- 5 files changed, 39 insertions(+), 48 deletions(-) diff --git a/ansible/vars.yml b/ansible/vars.yml index 813a133ba..dba3aff49 100644 --- a/ansible/vars.yml +++ b/ansible/vars.yml @@ -8,8 +8,8 @@ postgres_major: # Full version strings for each major version postgres_release: - postgresorioledb-17: "17.0.1.018-orioledb" - postgres15: "15.8.1.028" + postgresorioledb-17: "17.0.1.019-orioledb" + postgres15: "15.8.1.029" # Non Postgres Extensions pgbouncer_release: "1.19.0" diff --git a/migrations/schema-orioledb-17.sql b/migrations/schema-orioledb-17.sql index f28dc9a2e..531970c37 100644 --- a/migrations/schema-orioledb-17.sql +++ b/migrations/schema-orioledb-17.sql @@ -24,6 +24,13 @@ CREATE SCHEMA auth; CREATE SCHEMA extensions; +-- +-- Name: graphql; Type: SCHEMA; Schema: -; Owner: - +-- + +CREATE SCHEMA graphql; + + -- -- Name: graphql_public; Type: SCHEMA; Schema: -; Owner: - -- @@ -94,6 +101,20 @@ CREATE EXTENSION IF NOT EXISTS orioledb WITH SCHEMA public; COMMENT ON EXTENSION orioledb IS 'OrioleDB -- the next generation transactional engine'; +-- +-- Name: pg_graphql; Type: EXTENSION; Schema: -; Owner: - +-- + +CREATE EXTENSION IF NOT EXISTS pg_graphql WITH SCHEMA graphql; + + +-- +-- Name: EXTENSION pg_graphql; Type: COMMENT; Schema: -; Owner: - +-- + +COMMENT ON EXTENSION pg_graphql IS 'pg_graphql: GraphQL support'; + + -- -- Name: pg_stat_statements; Type: EXTENSION; Schema: -; Owner: - -- @@ -484,39 +505,6 @@ $_$; COMMENT ON FUNCTION extensions.set_graphql_placeholder() IS 'Reintroduces placeholder function for graphql_public.graphql'; --- --- Name: graphql(text, text, jsonb, jsonb); Type: FUNCTION; Schema: graphql_public; Owner: - --- - -CREATE FUNCTION graphql_public.graphql("operationName" text DEFAULT NULL::text, query text DEFAULT NULL::text, variables jsonb DEFAULT NULL::jsonb, extensions jsonb DEFAULT NULL::jsonb) RETURNS jsonb - LANGUAGE plpgsql - AS $$ - DECLARE - server_version float; - BEGIN - server_version = (SELECT (SPLIT_PART((select version()), ' ', 2))::float); - - IF server_version >= 14 THEN - RETURN jsonb_build_object( - 'errors', jsonb_build_array( - jsonb_build_object( - 'message', 'pg_graphql extension is not enabled.' - ) - ) - ); - ELSE - RETURN jsonb_build_object( - 'errors', jsonb_build_array( - jsonb_build_object( - 'message', 'pg_graphql is only available on projects running Postgres 14 onwards.' - ) - ) - ); - END IF; - END; -$$; - - -- -- Name: get_auth(text); Type: FUNCTION; Schema: pgbouncer; Owner: - -- @@ -625,7 +613,7 @@ CREATE FUNCTION vault.secrets_encrypt_secret_secret() RETURNS trigger SET default_tablespace = ''; -SET default_table_access_method = heap; +SET default_table_access_method = orioledb; -- -- Name: audit_log_entries; Type: TABLE; Schema: auth; Owner: - diff --git a/nix/ext/orioledb.nix b/nix/ext/orioledb.nix index ab6b9e39a..856539d56 100644 --- a/nix/ext/orioledb.nix +++ b/nix/ext/orioledb.nix @@ -6,19 +6,25 @@ stdenv.mkDerivation rec { src = fetchFromGitHub { owner = "orioledb"; repo = "orioledb"; - rev = "beta8"; - sha256 = "sha256-niyTQr1FQYEsKdxl/uVrKSiIR0DCnnT+DDkW47lsc80="; + rev = "beta9"; + sha256 = "sha256-z2EHWsY+hhtnYzAxOl2PWjqfyJ+wp9SCau5LKPT2ec0="; }; - version = "beta8"; + version = "beta9"; buildInputs = [ curl libkrb5 postgresql python3 openssl ]; buildPhase = "make USE_PGXS=1 ORIOLEDB_PATCHSET_VERSION=5"; installPhase = '' runHook preInstall + mkdir -p $out/{lib,share/postgresql/extension} - cp *${postgresql.dlSuffix} $out/lib - cp *.sql $out/share/postgresql/extension - cp *.control $out/share/postgresql/extension + # Copy the extension library + cp orioledb${postgresql.dlSuffix} $out/lib/ + + # Copy sql files from the sql directory + cp sql/*.sql $out/share/postgresql/extension/ + + # Copy control file + cp orioledb.control $out/share/postgresql/extension/ runHook postInstall ''; diff --git a/nix/tests/expected/z_17_ext_interface.out b/nix/tests/expected/z_17_ext_interface.out index d611dc0fb..5a0dc32d3 100644 --- a/nix/tests/expected/z_17_ext_interface.out +++ b/nix/tests/expected/z_17_ext_interface.out @@ -1090,8 +1090,6 @@ order by orioledb | public | orioledb_index_oids | OUT datoid oid, OUT table_reloid oid, OUT table_relnode oid, OUT index_reloid oid, OUT index_relnode oid, OUT index_type text | SETOF record orioledb | public | orioledb_index_rows | relid oid, OUT total integer, OUT dead integer | record orioledb | public | orioledb_page_stats | OUT pool_name text, OUT busy_pages bigint, OUT free_pages bigint, OUT dirty_pages bigint, OUT all_pages bigint | SETOF record - orioledb | public | orioledb_parallel_debug_start | | void - orioledb | public | orioledb_parallel_debug_stop | | void orioledb | public | orioledb_recovery_synchronized | | boolean orioledb | public | orioledb_relation_size | relid oid | bigint orioledb | public | orioledb_sys_tree_check | num integer, force_map_check boolean | boolean @@ -1108,14 +1106,13 @@ order by orioledb | public | orioledb_tbl_compression_check | level bigint, relid oid, ranges integer[] | text orioledb | public | orioledb_tbl_indices | relid oid | text orioledb | public | orioledb_tbl_structure | relid oid, options character varying, depth integer | text + orioledb | public | orioledb_tree_stat | relid regclass, OUT level integer, OUT count bigint, OUT avgoccupied double precision, OUT avgvacated double precision | SETOF record orioledb | public | orioledb_ucm_check | | boolean orioledb | public | orioledb_version | | text orioledb | public | orioledb_write_pages | relid oid | void orioledb | public | pg_stopevent_reset | eventname text | boolean orioledb | public | pg_stopevent_set | eventname text, condition jsonpath | void orioledb | public | pg_stopevents | OUT stopevent text, OUT condition jsonpath, OUT waiter_pids integer[] | SETOF record - orioledb | public | s3_get | objectname text | text - orioledb | public | s3_put | objectname text, filename text | text pageinspect | public | brin_metapage_info | page bytea, OUT magic text, OUT version integer, OUT pagesperrange integer, OUT lastrevmappage bigint | record pageinspect | public | brin_page_type | page bytea | text pageinspect | public | brin_revmap_data | page bytea, OUT pages tid | SETOF tid @@ -4888,7 +4885,7 @@ order by xml2 | public | xpath_table | text, text, text, text, text | SETOF record xml2 | public | xslt_process | text, text | text xml2 | public | xslt_process | text, text, text | text -(4729 rows) +(4726 rows) /* diff --git a/nix/tools/dbmate-tool.sh.in b/nix/tools/dbmate-tool.sh.in index b7aa0d26e..b41e83f0b 100644 --- a/nix/tools/dbmate-tool.sh.in +++ b/nix/tools/dbmate-tool.sh.in @@ -156,7 +156,7 @@ trim_schema() { } overmind_start() { cat > Procfile << EOF -postgres_${PSQL_VERSION}: exec nix run "$FLAKE_URL#start-server" "$PSQL_VERSION" +postgres_${PSQL_VERSION}: exec nix run "$FLAKE_URL#start-server" -- "$PSQL_VERSION" --skip-migrations EOF overmind start -D echo "Waiting for overmind socket..."