From 923b979386d91ebc591527e17b758aee8b51f176 Mon Sep 17 00:00:00 2001 From: Scott Trinh Date: Thu, 26 Sep 2024 10:28:43 -0400 Subject: [PATCH 1/3] Update bundled PostgreSQL to 16.4 tag: REL_16_4 --- postgres | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/postgres b/postgres index b78fa8547d0..2caa85f4aae 160000 --- a/postgres +++ b/postgres @@ -1 +1 @@ -Subproject commit b78fa8547d02fc72ace679fb4d5289dccdbfc781 +Subproject commit 2caa85f4aae689e6f6721d7363b4c66a2a6417d6 From e65722080c78200c2f5cc15f9c2c6feecb2fb1cd Mon Sep 17 00:00:00 2001 From: Scott Trinh Date: Thu, 26 Sep 2024 10:29:24 -0400 Subject: [PATCH 2/3] Add additional set_config to allowlist See https://github.com/postgres/postgres/commit/66e94448abec3aad04faf0a79cab4881ae08e08a --- edb/pgsql/resolver/static.py | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/edb/pgsql/resolver/static.py b/edb/pgsql/resolver/static.py index b74dd7dd12f..16b48d29014 100644 --- a/edb/pgsql/resolver/static.py +++ b/edb/pgsql/resolver/static.py @@ -179,9 +179,13 @@ def eval_FuncCall( ) if fn_name == "set_config": - # HACK: allow set_config('search_path', '', false) to support pg_dump - # HACK: allow set_config('bytea_output','hex',false) to support pgadmin - # HACK: allow set_config('jit', ...) to support asyncpg + # HACK: pg_dump + # - set_config('search_path', '', false) + # - set_config(name, 'view, foreign-table', false) + # HACK: pgadmin + # - set_config('bytea_output','hex',false) + # HACK: asyncpg + # - set_config('jit', ...) if args := eval_list(expr.args, ctx=ctx): name, value, is_local = args if isinstance(name, pgast.StringConstant): @@ -205,6 +209,15 @@ def eval_FuncCall( if name.val == "jit": return value + if ( + isinstance(value, pgast.StringConstant) + and isinstance(is_local, pgast.BooleanConstant) + ): + if ( + value.val == "view, foreign-table" + and not is_local.val + ): + return value raise errors.QueryError( "function set_config is not supported", span=expr.span From 7d569efda0513114c99be005f2a00057bbd7f9d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alja=C5=BE=20Mur=20Er=C5=BEen?= Date: Fri, 27 Sep 2024 12:52:40 +0200 Subject: [PATCH 3/3] fix --- edb/pgsql/resolver/static.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/edb/pgsql/resolver/static.py b/edb/pgsql/resolver/static.py index 16b48d29014..5ee8fdaf131 100644 --- a/edb/pgsql/resolver/static.py +++ b/edb/pgsql/resolver/static.py @@ -209,6 +209,9 @@ def eval_FuncCall( if name.val == "jit": return value + + elif args := eval_list(expr.args[1:], ctx=ctx): + value, is_local = args if ( isinstance(value, pgast.StringConstant) and isinstance(is_local, pgast.BooleanConstant)