perf: use pg_basetype on PG 17+ for schema cache

This commit is contained in:
Joel Jacobson
2026-08-02 11:47:26 +00:00
committed by Wolfgang Walther
parent 6a7ad33524
commit 131df9b578
11 changed files with 118 additions and 88 deletions
+1 -1
View File
@@ -783,7 +783,7 @@ def test_log_query(level, defaultenv):
)
infinite_recursion_5xx_regx = r'.+: WITH pgrst_source AS.+SELECT "public"\."infinite_recursion"\.\* FROM "public"\."infinite_recursion".+_postgrest_t'
root_tables_regx = r".+: SELECT n.nspname AS table_schema, .+ FROM pg_class c .+ ORDER BY table_schema, table_name"
root_procs_regx = r".+: WITH base_types AS \(.+\) SELECT pn.nspname AS proc_schema, .+ FROM pg_proc p.+AND p.pronamespace = \$1::regnamespace"
root_procs_regx = r".+: WITH.+base_types AS.+pn\.nspname AS proc_schema.+FROM pg_proc p.+p\.pronamespace = \$1::regnamespace"
root_descr_regx = r".+: SELECT pg_catalog\.obj_description\(\$1::regnamespace, 'pg_namespace'\)"
set_config_regx = (
r".+: select set_config\('search_path', \$1, true\), set_config\("
+3 -3
View File
@@ -48,7 +48,7 @@ main = do
actualPgVersion <- either (panic . show) id <$> P.use pool queryPgVersion
-- cached schema cache so most tests run fast
baseSchemaCache <- loadSCache pool testCfg
baseSchemaCache <- loadSCache pool actualPgVersion testCfg
let
initApp sCache config = do
@@ -72,5 +72,5 @@ main = do
describe "Feature.SchemaCacheSpec" Observation.SchemaCacheSpec.spec
where
loadSCache pool conf =
either (panic.show) fst <$> P.use pool (HT.transaction HT.ReadCommitted HT.Read $ querySchemaCache conf)
loadSCache pool pgVersion conf =
either (panic.show) fst <$> P.use pool (HT.transaction HT.ReadCommitted HT.Read $ querySchemaCache pgVersion conf)
+4 -4
View File
@@ -88,7 +88,7 @@ main = do
actualPgVersion <- either (panic . show) id <$> P.use pool queryPgVersion
-- cached schema cache so most tests run fast
baseSchemaCache <- loadSCache pool baseCfg
baseSchemaCache <- loadSCache pool actualPgVersion baseCfg
metricsState <- Metrics.init (configDbPoolSize baseCfg)
let
@@ -105,7 +105,7 @@ main = do
-- For tests that run with a different SchemaCache (depends on configSchemas)
appDbs config = do
customSchemaCache <- loadSCache pool config
customSchemaCache <- loadSCache pool actualPgVersion config
initApp customSchemaCache config
withConfig config = before (app config)
@@ -187,5 +187,5 @@ main = do
describe "Feature.Query.PgSafeUpdateSpec.spec" $ Feature.Query.PgSafeUpdateSpec.spec withConfig
where
loadSCache pool conf =
either (panic.show) fst <$> P.use pool (HT.transaction HT.ReadCommitted HT.Read $ querySchemaCache conf)
loadSCache pool pgVersion conf =
either (panic.show) fst <$> P.use pool (HT.transaction HT.ReadCommitted HT.Read $ querySchemaCache pgVersion conf)