From 019fceaba4a4a4b6b8a982526a69436c00308a15 Mon Sep 17 00:00:00 2001 From: Stojan Dimitrovski Date: Fri, 1 Nov 2024 13:14:48 +0100 Subject: [PATCH 1/2] feat: update envoy lds file to strip `sb-opk` header (#1297) --- ansible/files/envoy_config/lds.yaml | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/ansible/files/envoy_config/lds.yaml b/ansible/files/envoy_config/lds.yaml index f2c719d20..2fc7cae13 100644 --- a/ansible/files/envoy_config/lds.yaml +++ b/ansible/files/envoy_config/lds.yaml @@ -258,6 +258,9 @@ resources: max_program_size: 150 regex: >- /auth/v1/(verify|callback|authorize|sso/saml/(acs|metadata|slo)|\.well-known/(openid-configuration|jwks\.json)) + request_headers_to_remove: + - apikey + - sb-opk route: cluster: gotrue regex_rewrite: @@ -271,6 +274,9 @@ resources: typed_per_filter_config: *ref_0 - match: prefix: /auth/v1/ + request_headers_to_remove: + - apikey + - sb-opk route: cluster: gotrue prefix_rewrite: / @@ -282,6 +288,7 @@ resources: present_match: true request_headers_to_remove: - apikey + - sb-opk route: cluster: postgrest prefix_rewrite: / @@ -295,6 +302,7 @@ resources: prefix: /rest/v1/ request_headers_to_remove: - apikey + - sb-opk route: cluster: postgrest prefix_rewrite: / @@ -311,6 +319,7 @@ resources: present_match: true request_headers_to_remove: - apikey + - sb-opk route: cluster: postgrest_admin prefix_rewrite: / @@ -323,6 +332,7 @@ resources: prefix: /rest-admin/v1/ request_headers_to_remove: - apikey + - sb-opk route: cluster: postgrest_admin prefix_rewrite: / @@ -332,18 +342,25 @@ resources: header: key: Content-Profile value: graphql_public + request_headers_to_remove: + - apikey + - sb-opk route: cluster: postgrest prefix_rewrite: /rpc/graphql timeout: 125s - match: prefix: /admin/v1/ + request_headers_to_remove: + - sb-opk route: cluster: admin_api prefix_rewrite: / timeout: 600s - match: prefix: /customer/v1/privileged/ + request_headers_to_remove: + - sb-opk route: cluster: admin_api prefix_rewrite: /privileged/ @@ -367,6 +384,8 @@ resources: treat_missing_header_as_empty: true - match: prefix: /metrics/aggregated + request_headers_to_remove: + - sb-opk route: cluster: admin_api prefix_rewrite: /supabase-internal/metrics From f28c5d137da0b0c21b8c7aaa631e5861e470801e Mon Sep 17 00:00:00 2001 From: Oliver Rice Date: Fri, 1 Nov 2024 11:42:23 -0500 Subject: [PATCH 2/2] pgmq and partman owned by postgres vs supabase_admin (#1299) * remove pgmq and pg_partman (unreleased) until permissions issues resolved * align ext tests * bump 15.8 and 16.3 images w/o pgmq and pg_partman * convert ownership to postgres * minor test bugfix * 15 release only * remove partman * bump version num * align output for removing pg_partman * re-enable partman (not added back into tests yet) * fix suffix parsing for staging releases * remove pg_partman * remove partman from full list * prep for merge * align test output * restore wrappers release --- .github/workflows/ami-release-nix.yml | 2 +- .../files/postgresql_config/supautils.conf.j2 | 5 +- ansible/vars.yml | 4 +- flake.nix | 1 - .../expected/extensions_sql_interface.out | 105 +----------------- nix/tests/expected/pg_partman.out | 104 ----------------- nix/tests/expected/pgmq.out | 22 ++-- nix/tests/prime.sql | 1 - nix/tests/sql/pg_partman.sql | 85 -------------- nix/tests/sql/pgmq.sql | 7 +- 10 files changed, 25 insertions(+), 311 deletions(-) delete mode 100644 nix/tests/expected/pg_partman.out delete mode 100644 nix/tests/sql/pg_partman.sql diff --git a/.github/workflows/ami-release-nix.yml b/.github/workflows/ami-release-nix.yml index 643f26fc7..3242a4e1d 100644 --- a/.github/workflows/ami-release-nix.yml +++ b/.github/workflows/ami-release-nix.yml @@ -55,7 +55,7 @@ jobs: - name: Run checks if triggered manually if: ${{ github.event_name == 'workflow_dispatch' }} run: | - SUFFIX=$(sudo nix run nixpkgs#yq -- '.postgres_release["postgres${{ matrix.postgres_version }}"]' ansible/vars.yml | sed -E 's/[0-9\.]+(.*)$/\1/') + SUFFIX=$(sudo nix run nixpkgs#yq -- ".postgres_release[\"postgres${{ matrix.postgres_version }}\"]" ansible/vars.yml | sed -E 's/[0-9\.]+(.*)$/\1/') if [[ -z $SUFFIX ]] ; then echo "Version must include non-numeric characters if built manually." exit 1 diff --git a/ansible/files/postgresql_config/supautils.conf.j2 b/ansible/files/postgresql_config/supautils.conf.j2 index aa01cd8aa..b2112cf98 100644 --- a/ansible/files/postgresql_config/supautils.conf.j2 +++ b/ansible/files/postgresql_config/supautils.conf.j2 @@ -1,9 +1,10 @@ supautils.extensions_parameter_overrides = '{"pg_cron":{"schema":"pg_catalog"}}' supautils.policy_grants = '{"postgres":["auth.audit_log_entries","auth.identities","auth.refresh_tokens","auth.sessions","auth.users","realtime.messages","storage.buckets","storage.migrations","storage.objects","storage.s3_multipart_uploads","storage.s3_multipart_uploads_parts"]}' -# full list: address_standardizer, address_standardizer_data_us, adminpack, amcheck, autoinc, bloom, btree_gin, btree_gist, citext, cube, dblink, dict_int, dict_xsyn, earthdistance, file_fdw, fuzzystrmatch, hstore, http, hypopg, index_advisor, insert_username, intagg, intarray, isn, lo, ltree, moddatetime, old_snapshot, orioledb, pageinspect, pg_buffercache, pg_cron, pg_freespacemap, pg_graphql, pg_hashids, pg_jsonschema, pg_net, pg_prewarm, pg_repack, pg_stat_monitor, pg_stat_statements, pg_surgery, pg_tle, pg_trgm, pg_visibility, pg_walinspect, pgaudit, pgcrypto, pgjwt, pgroonga, pgroonga_database, pgrouting, pgrowlocks, pgsodium, pgstattuple, pgtap, plcoffee, pljava, plls, plpgsql, plpgsql_check, plv8, postgis, postgis_raster, postgis_sfcgal, postgis_tiger_geocoder, postgis_topology, postgres_fdw, refint, rum, seg, sslinfo, supabase_vault, supautils, tablefunc, tcn, timescaledb, tsm_system_rows, tsm_system_time, unaccent, uuid-ossp, vector, wrappers, xml2 +# full list: address_standardizer, address_standardizer_data_us, adminpack, amcheck, autoinc, bloom, btree_gin, btree_gist, citext, cube, dblink, dict_int, dict_xsyn, earthdistance, file_fdw, fuzzystrmatch, hstore, http, hypopg, index_advisor, insert_username, intagg, intarray, isn, lo, ltree, moddatetime, old_snapshot, orioledb, pageinspect, pg_buffercache, pg_cron, pg_freespacemap, pg_graphql, pg_hashids, pg_jsonschema, pg_net, pg_prewarm, pg_repack, pg_stat_monitor, pg_stat_statements, pg_surgery, pg_tle, pg_trgm, pg_visibility, pg_walinspect, pgaudit, pgcrypto, pgjwt, pgmq, pgroonga, pgroonga_database, pgrouting, pgrowlocks, pgsodium, pgstattuple, pgtap, plcoffee, pljava, plls, plpgsql, plpgsql_check, plv8, postgis, postgis_raster, postgis_sfcgal, postgis_tiger_geocoder, postgis_topology, postgres_fdw, refint, rum, seg, sslinfo, supabase_vault, supautils, tablefunc, tcn, timescaledb, tsm_system_rows, tsm_system_time, unaccent, uuid-ossp, vector, wrappers, xml2 # omitted because may be unsafe: adminpack, amcheck, file_fdw, lo, old_snapshot, pageinspect, pg_buffercache, pg_freespacemap, pg_surgery, pg_visibility # omitted because deprecated: intagg, xml2 -supautils.privileged_extensions = 'address_standardizer, address_standardizer_data_us, autoinc, bloom, btree_gin, btree_gist, citext, cube, dblink, dict_int, dict_xsyn, earthdistance, fuzzystrmatch, hstore, http, hypopg, index_advisor, insert_username, intarray, isn, ltree, moddatetime, orioledb, pg_cron, pg_graphql, pg_hashids, pg_jsonschema, pg_net, pg_partman, pg_repack, pg_stat_monitor, pg_stat_statements, pg_tle, pg_trgm, pg_walinspect, pgaudit, pgcrypto, pgjwt, pg_prewarm, pgmq, pgroonga, pgroonga_database, pgrouting, pgrowlocks, pgstattuple, pgsodium, pgtap, plcoffee, pljava, plls, plpgsql, plpgsql_check, plv8, postgis, postgis_raster, postgis_sfcgal, postgis_tiger_geocoder, postgis_topology, postgres_fdw, refint, rum, seg, sslinfo, supabase_vault, supautils, tablefunc, tcn, timescaledb, tsm_system_rows, tsm_system_time, unaccent, uuid-ossp, vector, wrappers' +# omitted because doesn't require superuser: pgmq +supautils.privileged_extensions = 'address_standardizer, address_standardizer_data_us, autoinc, bloom, btree_gin, btree_gist, citext, cube, dblink, dict_int, dict_xsyn, earthdistance, fuzzystrmatch, hstore, http, hypopg, index_advisor, insert_username, intarray, isn, ltree, moddatetime, orioledb, pg_cron, pg_graphql, pg_hashids, pg_jsonschema, pg_net, pg_prewarm, pg_repack, pg_stat_monitor, pg_stat_statements, pg_tle, pg_trgm, pg_walinspect, pgaudit, pgcrypto, pgjwt, pgroonga, pgroonga_database, pgrouting, pgrowlocks, pgsodium, pgstattuple, pgtap, plcoffee, pljava, plls, plpgsql, plpgsql_check, plv8, postgis, postgis_raster, postgis_sfcgal, postgis_tiger_geocoder, postgis_topology, postgres_fdw, refint, rum, seg, sslinfo, supabase_vault, supautils, tablefunc, tcn, timescaledb, tsm_system_rows, tsm_system_time, unaccent, uuid-ossp, vector, wrappers' supautils.privileged_extensions_custom_scripts_path = '/etc/postgresql-custom/extension-custom-scripts' supautils.privileged_extensions_superuser = 'supabase_admin' supautils.privileged_role = 'postgres' diff --git a/ansible/vars.yml b/ansible/vars.yml index 129e1a238..fbc9bf6ba 100644 --- a/ansible/vars.yml +++ b/ansible/vars.yml @@ -11,8 +11,8 @@ postgres_major: # Full version strings for each major version postgres_release: - postgres15: "15.8.1.004" - postgres16: "16.3.1.010" + postgres15: "15.8.1.005" + postgres16: "16.3.1.011" # Non Postgres Extensions pgbouncer_release: "1.19.0" diff --git a/flake.nix b/flake.nix index 3014f9032..857f5d66c 100644 --- a/flake.nix +++ b/flake.nix @@ -151,7 +151,6 @@ ./nix/ext/pg_hashids.nix ./nix/ext/pgsodium.nix ./nix/ext/pg_graphql.nix - ./nix/ext/pg_partman.nix ./nix/ext/pg_stat_monitor.nix ./nix/ext/pg_jsonschema.nix ./nix/ext/pgvector.nix diff --git a/nix/tests/expected/extensions_sql_interface.out b/nix/tests/expected/extensions_sql_interface.out index 07c0d6650..fff273a88 100644 --- a/nix/tests/expected/extensions_sql_interface.out +++ b/nix/tests/expected/extensions_sql_interface.out @@ -76,7 +76,6 @@ order by pg_hashids | t pg_jsonschema | f pg_net | f - pg_partman | f pg_prewarm | t pg_repack | f pg_stat_monitor | t @@ -123,7 +122,7 @@ order by vector | t wrappers | f xml2 | f -(83 rows) +(82 rows) /* @@ -163,8 +162,8 @@ order by n.nspname, p.proname, pg_catalog.pg_get_function_identity_arguments(p.oid); - extension_name | schema_name | function_name | argument_types | return_type -------------------------+--------------------------+--------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ + extension_name | schema_name | function_name | argument_types | return_type +------------------------+--------------------------+--------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- address_standardizer | public | parse_address | text, OUT num text, OUT street text, OUT street2 text, OUT address1 text, OUT city text, OUT state text, OUT zip text, OUT zipplus text, OUT country text | record address_standardizer | public | standardize_address | lextab text, gaztab text, rultab text, address text | stdaddr address_standardizer | public | standardize_address | lextab text, gaztab text, rultab text, micro text, macro text | stdaddr @@ -1160,45 +1159,6 @@ order by pg_net | net | http_get | url text, params jsonb, headers jsonb, timeout_milliseconds integer | bigint pg_net | net | http_post | url text, body jsonb, params jsonb, headers jsonb, timeout_milliseconds integer | bigint pg_net | net | worker_restart | | boolean - pg_partman | public | apply_cluster | p_parent_schema text, p_parent_tablename text, p_child_schema text, p_child_tablename text | void - pg_partman | public | apply_constraints | p_parent_table text, p_child_table text, p_analyze boolean, p_job_id bigint | void - pg_partman | public | apply_privileges | p_parent_schema text, p_parent_tablename text, p_child_schema text, p_child_tablename text, p_job_id bigint | void - pg_partman | public | autovacuum_off | p_parent_schema text, p_parent_tablename text, p_source_schema text, p_source_tablename text | boolean - pg_partman | public | autovacuum_reset | p_parent_schema text, p_parent_tablename text, p_source_schema text, p_source_tablename text | boolean - pg_partman | public | calculate_time_partition_info | p_time_interval interval, p_start_time timestamp with time zone, p_date_trunc_interval text, OUT base_timestamp timestamp with time zone, OUT datetime_string text | record - pg_partman | public | check_automatic_maintenance_value | p_automatic_maintenance text | boolean - pg_partman | public | check_control_type | p_parent_schema text, p_parent_tablename text, p_control text | TABLE(general_type text, exact_type text) - pg_partman | public | check_default | p_exact_count boolean | SETOF check_default_table - pg_partman | public | check_epoch_type | p_type text | boolean - pg_partman | public | check_name_length | p_object_name text, p_suffix text, p_table_partition boolean | text - pg_partman | public | check_partition_type | p_type text | boolean - pg_partman | public | check_subpart_sameconfig | p_parent_table text | TABLE(sub_control text, sub_partition_interval text, sub_partition_type text, sub_premake integer, sub_automatic_maintenance text, sub_template_table text, sub_retention text, sub_retention_schema text, sub_retention_keep_index boolean, sub_retention_keep_table boolean, sub_epoch text, sub_constraint_cols text[], sub_optimize_constraint integer, sub_infinite_time_partitions boolean, sub_jobmon boolean, sub_inherit_privileges boolean, sub_constraint_valid boolean, sub_date_trunc_interval text, sub_ignore_default_data boolean, sub_default_table boolean, sub_maintenance_order integer, sub_retention_keep_publication boolean) - pg_partman | public | check_subpartition_limits | p_parent_table text, p_type text, OUT sub_min text, OUT sub_max text | record - pg_partman | public | create_parent | p_parent_table text, p_control text, p_interval text, p_type text, p_epoch text, p_premake integer, p_start_partition text, p_default_table boolean, p_automatic_maintenance text, p_constraint_cols text[], p_template_table text, p_jobmon boolean, p_date_trunc_interval text | boolean - pg_partman | public | create_partition_id | p_parent_table text, p_partition_ids bigint[], p_start_partition text | boolean - pg_partman | public | create_partition_time | p_parent_table text, p_partition_times timestamp with time zone[], p_start_partition text | boolean - pg_partman | public | create_sub_parent | p_top_parent text, p_control text, p_interval text, p_type text, p_default_table boolean, p_declarative_check text, p_constraint_cols text[], p_premake integer, p_start_partition text, p_epoch text, p_jobmon boolean, p_date_trunc_interval text | boolean - pg_partman | public | drop_constraints | p_parent_table text, p_child_table text, p_debug boolean | void - pg_partman | public | drop_partition_id | p_parent_table text, p_retention bigint, p_keep_table boolean, p_keep_index boolean, p_retention_schema text | integer - pg_partman | public | drop_partition_time | p_parent_table text, p_retention interval, p_keep_table boolean, p_keep_index boolean, p_retention_schema text, p_reference_timestamp timestamp with time zone | integer - pg_partman | public | dump_partitioned_table_definition | p_parent_table text, p_ignore_template_table boolean | text - pg_partman | public | inherit_replica_identity | p_parent_schemaname text, p_parent_tablename text, p_child_tablename text | void - pg_partman | public | inherit_template_properties | p_parent_table text, p_child_schema text, p_child_tablename text | boolean - pg_partman | public | partition_data_id | p_parent_table text, p_batch_count integer, p_batch_interval bigint, p_lock_wait numeric, p_order text, p_analyze boolean, p_source_table text, p_ignored_columns text[] | bigint - pg_partman | public | partition_data_proc | IN p_parent_table text, IN p_loop_count integer, IN p_interval text, IN p_lock_wait integer, IN p_lock_wait_tries integer, IN p_wait integer, IN p_order text, IN p_source_table text, IN p_ignored_columns text[], IN p_quiet boolean | - pg_partman | public | partition_data_time | p_parent_table text, p_batch_count integer, p_batch_interval interval, p_lock_wait numeric, p_order text, p_analyze boolean, p_source_table text, p_ignored_columns text[] | bigint - pg_partman | public | partition_gap_fill | p_parent_table text | integer - pg_partman | public | reapply_constraints_proc | IN p_parent_table text, IN p_drop_constraints boolean, IN p_apply_constraints boolean, IN p_wait integer, IN p_dryrun boolean | - pg_partman | public | reapply_privileges | p_parent_table text | void - pg_partman | public | run_analyze | IN p_skip_locked boolean, IN p_quiet boolean, IN p_parent_table text | - pg_partman | public | run_maintenance | p_parent_table text, p_analyze boolean, p_jobmon boolean | void - pg_partman | public | run_maintenance_proc | IN p_wait integer, IN p_analyze boolean, IN p_jobmon boolean | - pg_partman | public | show_partition_info | p_child_table text, p_partition_interval text, p_parent_table text, OUT child_start_time timestamp with time zone, OUT child_end_time timestamp with time zone, OUT child_start_id bigint, OUT child_end_id bigint, OUT suffix text | record - pg_partman | public | show_partition_name | p_parent_table text, p_value text, OUT partition_schema text, OUT partition_table text, OUT suffix_timestamp timestamp with time zone, OUT suffix_id bigint, OUT table_exists boolean | record - pg_partman | public | show_partitions | p_parent_table text, p_order text, p_include_default boolean | TABLE(partition_schemaname text, partition_tablename text) - pg_partman | public | stop_sub_partition | p_parent_table text, p_jobmon boolean | boolean - pg_partman | public | undo_partition | p_parent_table text, p_target_table text, p_loop_count integer, p_batch_interval text, p_keep_table boolean, p_lock_wait numeric, p_ignored_columns text[], p_drop_cascade boolean, OUT partitions_undone integer, OUT rows_undone bigint | record - pg_partman | public | undo_partition_proc | IN p_parent_table text, IN p_target_table text, IN p_loop_count integer, IN p_interval text, IN p_keep_table boolean, IN p_lock_wait integer, IN p_lock_wait_tries integer, IN p_wait integer, IN p_ignored_columns text[], IN p_drop_cascade boolean, IN p_quiet boolean | pg_prewarm | public | autoprewarm_dump_now | | bigint pg_prewarm | public | autoprewarm_start_worker | | void pg_prewarm | public | pg_prewarm | regclass, mode text, fork text, first_block bigint, last_block bigint | bigint @@ -5234,7 +5194,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 -(5069 rows) +(5030 rows) /* @@ -5317,61 +5277,6 @@ order by pg_net | net | http_request_queue | method pg_net | net | http_request_queue | timeout_milliseconds pg_net | net | http_request_queue | url - pg_partman | public | part_config | automatic_maintenance - pg_partman | public | part_config | constraint_cols - pg_partman | public | part_config | constraint_valid - pg_partman | public | part_config | control - pg_partman | public | part_config | date_trunc_interval - pg_partman | public | part_config | datetime_string - pg_partman | public | part_config | default_table - pg_partman | public | part_config | epoch - pg_partman | public | part_config | ignore_default_data - pg_partman | public | part_config | infinite_time_partitions - pg_partman | public | part_config | inherit_privileges - pg_partman | public | part_config | jobmon - pg_partman | public | part_config | maintenance_last_run - pg_partman | public | part_config | maintenance_order - pg_partman | public | part_config | optimize_constraint - pg_partman | public | part_config | parent_table - pg_partman | public | part_config | partition_interval - pg_partman | public | part_config | partition_type - pg_partman | public | part_config | premake - pg_partman | public | part_config | retention - pg_partman | public | part_config | retention_keep_index - pg_partman | public | part_config | retention_keep_publication - pg_partman | public | part_config | retention_keep_table - pg_partman | public | part_config | retention_schema - pg_partman | public | part_config | sub_partition_set_full - pg_partman | public | part_config | template_table - pg_partman | public | part_config | undo_in_progress - pg_partman | public | part_config_sub | sub_automatic_maintenance - pg_partman | public | part_config_sub | sub_constraint_cols - pg_partman | public | part_config_sub | sub_constraint_valid - pg_partman | public | part_config_sub | sub_control - pg_partman | public | part_config_sub | sub_date_trunc_interval - pg_partman | public | part_config_sub | sub_default_table - pg_partman | public | part_config_sub | sub_epoch - pg_partman | public | part_config_sub | sub_ignore_default_data - pg_partman | public | part_config_sub | sub_infinite_time_partitions - pg_partman | public | part_config_sub | sub_inherit_privileges - pg_partman | public | part_config_sub | sub_jobmon - pg_partman | public | part_config_sub | sub_maintenance_order - pg_partman | public | part_config_sub | sub_optimize_constraint - pg_partman | public | part_config_sub | sub_parent - pg_partman | public | part_config_sub | sub_partition_interval - pg_partman | public | part_config_sub | sub_partition_type - pg_partman | public | part_config_sub | sub_premake - pg_partman | public | part_config_sub | sub_retention - pg_partman | public | part_config_sub | sub_retention_keep_index - pg_partman | public | part_config_sub | sub_retention_keep_publication - pg_partman | public | part_config_sub | sub_retention_keep_table - pg_partman | public | part_config_sub | sub_retention_schema - pg_partman | public | part_config_sub | sub_template_table - pg_partman | public | table_privs | grantee - pg_partman | public | table_privs | grantor - pg_partman | public | table_privs | privilege_type - pg_partman | public | table_privs | table_name - pg_partman | public | table_privs | table_schema pg_repack | repack | primary_keys | indexrelid pg_repack | repack | primary_keys | indrelid pg_repack | repack | tables | alter_col_storage @@ -6409,5 +6314,5 @@ order by wrappers | public | wrappers_fdw_stats | rows_in wrappers | public | wrappers_fdw_stats | rows_out wrappers | public | wrappers_fdw_stats | updated_at -(1141 rows) +(1086 rows) diff --git a/nix/tests/expected/pg_partman.out b/nix/tests/expected/pg_partman.out deleted file mode 100644 index 25aa80d2e..000000000 --- a/nix/tests/expected/pg_partman.out +++ /dev/null @@ -1,104 +0,0 @@ -create schema if not exists partman_test; -/* -Simple Time Based: 1 Partition Per Day - -For native partitioning, you must start with a parent table that has already been set up to be partitioned in the desired type. Currently pg_partman only supports the RANGE type of partitioning (both for time & id). You cannot turn a non-partitioned table into the parent table of a partitioned set, which can make migration a challenge. This document will show you some techniques for how to manage this later. For now, we will start with a brand new table in this example. Any non-unique indexes can also be added to the parent table in PG11+ and they will automatically be created on all child tables. -*/ -create table partman_test.time_taptest_table( - col1 int, - col2 text default 'stuff', - col3 timestamptz not null default now() -) - partition by range (col3); -create index on partman_test.time_tap (col3); -ERROR: relation "partman_test.time_tap" does not exist -/* -Unique indexes (including primary keys) cannot be created on a natively partitioned parent unless they include the partition key. For time-based partitioning that generally doesn't work out since that would limit only a single timestamp value in each child table. pg_partman helps to manage this by using a template table to manage properties that currently are not supported by native partitioning. Note that this does not solve the issue of the constraint not being enforced across the entire partition set. See the main documentation to see which properties are managed by the template. - -Manually create the template table first so that when we run create_parent() the initial child tables that are created will have a primary key. If you do not supply a template table to pg_partman, it will create one for you in the schema that you installed the extension to. However properties you add to that template are only then applied to newly created child tables after that point. You will have to retroactively apply those properties manually to any child tables that already existed. -*/ -create table partman_test.time_taptest_table_template (like partman_test.time_taptest_table); -alter table partman_test.time_taptest_table_template add primary key (col1); -/* -Review tables in the partman_test schema -*/ -select - table_name, - table_type -from - information_schema.tables -where - table_schema = 'partman_test' -order by - table_name, - table_type; - table_name | table_type ------------------------------+------------ - time_taptest_table | BASE TABLE - time_taptest_table_template | BASE TABLE -(2 rows) - -select public.create_parent( - p_parent_table := 'partman_test.time_taptest_table', - p_control := 'col3', - p_interval := '1 day', - p_template_table := 'partman_test.time_taptest_table_template' -); - create_parent ---------------- - t -(1 row) - -/* -Review tables in the partman_test schema, which should now include daily partitions -*/ -select - -- dates in partition names are variable, so reduced to the prefix - substring(table_name, 1, 21) as table_prefix, - table_type -from - information_schema.tables -where - table_schema = 'partman_test' -order by - table_name; - table_prefix | table_type ------------------------+------------ - time_taptest_table | BASE TABLE - time_taptest_table_de | BASE TABLE - time_taptest_table_p2 | BASE TABLE - time_taptest_table_p2 | BASE TABLE - time_taptest_table_p2 | BASE TABLE - time_taptest_table_p2 | BASE TABLE - time_taptest_table_p2 | BASE TABLE - time_taptest_table_p2 | BASE TABLE - time_taptest_table_p2 | BASE TABLE - time_taptest_table_p2 | BASE TABLE - time_taptest_table_p2 | BASE TABLE - time_taptest_table_te | BASE TABLE -(12 rows) - -/* -Confirm maintenance proc runs without issue -*/ -call public.run_maintenance_proc(); -/* -Make sure the background worker is NOT enabled. -This is intentional. We document using pg_cron to schedule calls to -public.run_maintenance_proc(). That is consistent with other providers. -*/ -select - application_name -from - pg_stat_activity -where - application_name = 'pg_partman_bgw'; - application_name ------------------- -(0 rows) - --- Cleanup -drop schema partman_test cascade; -NOTICE: drop cascades to 2 other objects -DETAIL: drop cascades to table partman_test.time_taptest_table -drop cascades to table partman_test.time_taptest_table_template diff --git a/nix/tests/expected/pgmq.out b/nix/tests/expected/pgmq.out index b2886d9fa..9fb18191b 100644 --- a/nix/tests/expected/pgmq.out +++ b/nix/tests/expected/pgmq.out @@ -20,18 +20,18 @@ from -- Test queue is not case sensitive select - msg_id, - read_ct, - message + * from pgmq.send( queue_name:='foo', -- note: lowercase useage msg:='{"foo": "bar2"}', delay:=5 ); -ERROR: column "msg_id" does not exist -LINE 2: msg_id, - ^ + send +------ + 2 +(1 row) + select msg_id, read_ct, @@ -65,7 +65,7 @@ select ); archive --------- - f + t (1 row) select @@ -111,17 +111,15 @@ select t (1 row) +/* +-- Disabled until pg_partman goes back into the image select pgmq.create_partitioned( 'my_partitioned_queue', '5 seconds', '10 seconds' ); - create_partitioned --------------------- - -(1 row) - +*/ -- Make sure SQLI enabling characters are blocked select pgmq.create('F--oo'); ERROR: queue name contains invalid characters: $, ;, --, or \' diff --git a/nix/tests/prime.sql b/nix/tests/prime.sql index 3891817e1..a72f3bf48 100644 --- a/nix/tests/prime.sql +++ b/nix/tests/prime.sql @@ -43,7 +43,6 @@ create extension pg_graphql; create extension pg_freespacemap; create extension pg_hashids; create extension pg_prewarm; -create extension pg_partman; create extension pg_jsonschema; create extension pg_repack; create extension pg_stat_monitor; diff --git a/nix/tests/sql/pg_partman.sql b/nix/tests/sql/pg_partman.sql deleted file mode 100644 index d1fb9f4ba..000000000 --- a/nix/tests/sql/pg_partman.sql +++ /dev/null @@ -1,85 +0,0 @@ -create schema if not exists partman_test; - -/* -Simple Time Based: 1 Partition Per Day - -For native partitioning, you must start with a parent table that has already been set up to be partitioned in the desired type. Currently pg_partman only supports the RANGE type of partitioning (both for time & id). You cannot turn a non-partitioned table into the parent table of a partitioned set, which can make migration a challenge. This document will show you some techniques for how to manage this later. For now, we will start with a brand new table in this example. Any non-unique indexes can also be added to the parent table in PG11+ and they will automatically be created on all child tables. -*/ - -create table partman_test.time_taptest_table( - col1 int, - col2 text default 'stuff', - col3 timestamptz not null default now() -) - partition by range (col3); - -create index on partman_test.time_tap (col3); - -/* -Unique indexes (including primary keys) cannot be created on a natively partitioned parent unless they include the partition key. For time-based partitioning that generally doesn't work out since that would limit only a single timestamp value in each child table. pg_partman helps to manage this by using a template table to manage properties that currently are not supported by native partitioning. Note that this does not solve the issue of the constraint not being enforced across the entire partition set. See the main documentation to see which properties are managed by the template. - -Manually create the template table first so that when we run create_parent() the initial child tables that are created will have a primary key. If you do not supply a template table to pg_partman, it will create one for you in the schema that you installed the extension to. However properties you add to that template are only then applied to newly created child tables after that point. You will have to retroactively apply those properties manually to any child tables that already existed. -*/ - -create table partman_test.time_taptest_table_template (like partman_test.time_taptest_table); - -alter table partman_test.time_taptest_table_template add primary key (col1); - -/* -Review tables in the partman_test schema -*/ - -select - table_name, - table_type -from - information_schema.tables -where - table_schema = 'partman_test' -order by - table_name, - table_type; - - -select public.create_parent( - p_parent_table := 'partman_test.time_taptest_table', - p_control := 'col3', - p_interval := '1 day', - p_template_table := 'partman_test.time_taptest_table_template' -); - -/* -Review tables in the partman_test schema, which should now include daily partitions -*/ - -select - -- dates in partition names are variable, so reduced to the prefix - substring(table_name, 1, 21) as table_prefix, - table_type -from - information_schema.tables -where - table_schema = 'partman_test' -order by - table_name; - - -/* -Confirm maintenance proc runs without issue -*/ -call public.run_maintenance_proc(); - -/* -Make sure the background worker is NOT enabled. -This is intentional. We document using pg_cron to schedule calls to -public.run_maintenance_proc(). That is consistent with other providers. -*/ -select - application_name -from - pg_stat_activity -where - application_name = 'pg_partman_bgw'; - --- Cleanup -drop schema partman_test cascade; diff --git a/nix/tests/sql/pgmq.sql b/nix/tests/sql/pgmq.sql index 4d4045484..cd47cc34d 100644 --- a/nix/tests/sql/pgmq.sql +++ b/nix/tests/sql/pgmq.sql @@ -12,9 +12,7 @@ from -- Test queue is not case sensitive select - msg_id, - read_ct, - message + * from pgmq.send( queue_name:='foo', -- note: lowercase useage @@ -71,12 +69,15 @@ select select pgmq.drop_queue('my_queue'); +/* +-- Disabled until pg_partman goes back into the image select pgmq.create_partitioned( 'my_partitioned_queue', '5 seconds', '10 seconds' ); +*/ -- Make sure SQLI enabling characters are blocked