Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make sure config spec-dependent functions are regened when grafting testmode #8283

Merged
merged 1 commit into from
Jan 31, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions edb/pgsql/metaschema.py
Original file line number Diff line number Diff line change
Expand Up @@ -8239,6 +8239,26 @@ async def generate_support_functions(
return trampoline_functions(cmds)


async def regenerate_config_support_functions(
conn: PGConnection,
config_spec: edbconfig.Spec,
) -> None:
# Regenerate functions dependent on config spec.
commands = dbops.CommandGroup()

funcs = [
ApplySessionConfigFunction(config_spec),
PostgresJsonConfigValueToFrontendConfigValueFunction(config_spec),
]

cmds = [dbops.CreateFunction(func, or_replace=True) for func in funcs]
commands.add_commands(cmds)

block = dbops.PLTopBlock()
commands.generate(block)
await _execute_block(conn, block)


async def generate_more_support_functions(
conn: PGConnection,
compiler: edbcompiler.Compiler,
Expand Down
4 changes: 3 additions & 1 deletion edb/server/bootstrap.py
Original file line number Diff line number Diff line change
Expand Up @@ -1781,8 +1781,10 @@ async def _init_stdlib(
await conn.sql_execute(testmode_sql.encode("utf-8"))
trampolines.extend(new_trampolines)
# _testmode includes extra config settings, so make sure
# those are picked up.
# those are picked up...
config_spec = config.load_spec_from_schema(stdlib.stdschema)
# ...and that config functions dependent on it are regenerated
await metaschema.regenerate_config_support_functions(conn, config_spec)

logger.info('Finalizing database setup...')

Expand Down
Loading