supabase / postgres

Unmodified Postgres with some useful plugins
https://supabase.com
PostgreSQL License
1.38k stars 139 forks source link

Test for changes in all extension public interfaces #1093

Closed olirice closed 2 months ago

olirice commented 2 months ago

Creates a test /nix/test/sql/extensions_sql_interface.out

that monitors extension owned functions, tables, views, matviews, and indexes for changes as versions get bumped

We will use this to proactively monitor for breaking changes that could impact pause/restore before extensions go to production

Currently the test is very broad and includes functions etc that are prefixed with _<something> implying that they are internal. If we see a lot of low impact churn in those functions we can exclude them but for now I figured it makes sense to be as cautious as possible.

pcnc commented 2 months ago

Looks good - some tests seem to already be failing (intended?)

We could have the workflow output the regression output file as an artifact in case it exists, to surface the impacted changes more easily - this workflow points the regression test output as being located at /nix/store/q4bw6l6wkiz1hljvqwl5f93j7ifx1nnj-postgres-15.6-check-harness/regression_output/regression.out

steve-chavez commented 2 months ago

Getting a failure locally, some differences on plcoffee, plls, plv8. This is the diff:

diff -U3 /nix/store/7dmppm4f3a21iddmvy924llqxh60ipl0-tests/expected/extensions_sql_interface.out /nix/store/lnwy4z38namdhv859s2pc0jfnklgb42x-postgres-15.6-check-harness/regression_output/results/extensions_sql_interface.out
--- /nix/store/7dmppm4f3a21iddmvy924llqxh60ipl0-tests/expected/extensions_sql_interface.out 1970-01-01 00:00:01.000000000 +0000
+++ /nix/store/lnwy4z38namdhv859s2pc0jfnklgb42x-postgres-15.6-check-harness/regression_output/results/extensions_sql_interface.out  2024-08-06 16:01:49.193370738 +0000
@@ -20,13 +20,10 @@
   installed_version is null
 order by
   name asc;
-   name   
-----------
+  name   
+---------
  pg_cron
- plcoffee
- plls
- plv8
-(4 rows)
+(1 row)

 /*

@@ -97,8 +94,11 @@
  pgsodium                     | f
  pgstattuple                  | t
  pgtap                        | t
+ plcoffee                     | f
+ plls                         | f
  plpgsql                      | f
  plpgsql_check                | f
+ plv8                         | f
  postgis                      | f
  postgis_raster               | f
  postgis_sfcgal               | t
@@ -120,7 +120,7 @@
  vector                       | t
  wrappers                     | f
  xml2                         | f
-(77 rows)
+(80 rows)

 /*

@@ -3028,6 +3028,12 @@
  pgtap                  | public                   | volatility_is                                    | name, name[], text, text                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   | text
  pgtap                  | public                   | volatility_is                                    | name, text                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 | text
  pgtap                  | public                   | volatility_is                                    | name, text, text                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           | text
+ plcoffee               | pg_catalog               | plcoffee_call_handler                            |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            | language_handler
+ plcoffee               | pg_catalog               | plcoffee_call_validator                          | oid                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        | void
+ plcoffee               | pg_catalog               | plcoffee_inline_handler                          | internal                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   | void
+ plls                   | pg_catalog               | plls_call_handler                                |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            | language_handler
+ plls                   | pg_catalog               | plls_call_validator                              | oid                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        | void
+ plls                   | pg_catalog               | plls_inline_handler                              | internal                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   | void
  plpgsql                | pg_catalog               | plpgsql_call_handler                             |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            | language_handler
  plpgsql                | pg_catalog               | plpgsql_inline_handler                           | internal                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   | void
  plpgsql                | pg_catalog               | plpgsql_validator                                | oid                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        | void
@@ -3053,6 +3059,12 @@
  plpgsql_check          | public                   | plpgsql_profiler_reset_all                       |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            | void
  plpgsql_check          | public                   | plpgsql_show_dependency_tb                       | fnname text, relid regclass                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                | TABLE(type text, oid oid, schema text, name text, params text)
  plpgsql_check          | public                   | plpgsql_show_dependency_tb                       | funcoid regprocedure, relid regclass                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       | TABLE(type text, oid oid, schema text, name text, params text)
+ plv8                   | pg_catalog               | plv8_call_handler                                |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            | language_handler
+ plv8                   | pg_catalog               | plv8_call_validator                              | oid                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        | void
+ plv8                   | pg_catalog               | plv8_info                                        |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            | json
+ plv8                   | pg_catalog               | plv8_inline_handler                              | internal                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   | void
+ plv8                   | pg_catalog               | plv8_reset                                       |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            | void
+ plv8                   | pg_catalog               | plv8_version                                     |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            | text
  postgis                | public                   | _postgis_deprecate                               | oldname text, newname text, version text                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   | void
  postgis                | public                   | _postgis_index_extent                            | tbl regclass, col text                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     | box2d
  postgis                | public                   | _postgis_join_selectivity                        | regclass, text, regclass, text, text                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       | double precision
@@ -5090,7 +5102,7 @@
  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
-(4940 rows)
+(4952 rows)

 /*
olirice commented 2 months ago

Initial output was produced on an M1 Mac and CI is running ubuntu. I'm firing up an old linux box at home to reproduce the diff but that's probably the culprit

olirice commented 2 months ago

I commented out the procedural languages to unblock this PR. Those were the ones causing issues on Mac Theres an issue for it here https://github.com/supabase/postgres/issues/1094