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

Don't emit instance configs matching their defaults in DESCRIBE INSTANCE CONFIG #8316

Merged
merged 1 commit into from
Feb 6, 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
10 changes: 10 additions & 0 deletions edb/edgeql/compiler/config_desc.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,16 @@ def _describe_config_inner(
condition = f'EXISTS json_get(conf, {ql(fpn)})'
if is_internal:
condition = f'({condition}) AND testmode'
# For INSTANCE, filter out configs that are set to the default.
# This is because we currently implement the defaults by
# setting them with CONFIGURE INSTANCE, so we can't detect
# defaults by seeing what is unset.
if (
scope == qltypes.ConfigScope.INSTANCE
and (default := p.get_default(schema))
):
condition = f'({condition}) AND {psource} ?!= ({default.text})'

items.append(f"(\n{item}\n IF {condition} ELSE ''\n )")

return items
Expand Down
5 changes: 5 additions & 0 deletions tests/test_server_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -1706,6 +1706,11 @@ async def test_server_config_db_config(self):
http_endpoint_security=args.ServerEndpointSecurityMode.Optional,
) as sd:
con1 = await sd.connect()

# Shouldn't be anything in INSTANCE CONFIG, to start.
res = await con1.query_single('DESCRIBE INSTANCE CONFIG;')
self.assertEqual(res, '')

con2 = await sd.connect()

await con1.execute('''
Expand Down