Skip to content

Commit

Permalink
Don't emit instance configs matching their defaults in DESCRIBE INSTA…
Browse files Browse the repository at this point in the history
…NCE CONFIG (#8316)

Doing this can cause some problems with dumps---they will appear in
dumps,
even though they may not be configurable on cloud.

Addresses part of #7332.
  • Loading branch information
msullivan committed Feb 6, 2025
1 parent 65def6d commit 71e46f6
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
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

0 comments on commit 71e46f6

Please sign in to comment.