Skip to content

Commit 71e46f6

Browse files
committed
Don't emit instance configs matching their defaults in DESCRIBE INSTANCE 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.
1 parent 65def6d commit 71e46f6

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

edb/edgeql/compiler/config_desc.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,16 @@ def _describe_config_inner(
188188
condition = f'EXISTS json_get(conf, {ql(fpn)})'
189189
if is_internal:
190190
condition = f'({condition}) AND testmode'
191+
# For INSTANCE, filter out configs that are set to the default.
192+
# This is because we currently implement the defaults by
193+
# setting them with CONFIGURE INSTANCE, so we can't detect
194+
# defaults by seeing what is unset.
195+
if (
196+
scope == qltypes.ConfigScope.INSTANCE
197+
and (default := p.get_default(schema))
198+
):
199+
condition = f'({condition}) AND {psource} ?!= ({default.text})'
200+
191201
items.append(f"(\n{item}\n IF {condition} ELSE ''\n )")
192202

193203
return items

tests/test_server_config.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1706,6 +1706,11 @@ async def test_server_config_db_config(self):
17061706
http_endpoint_security=args.ServerEndpointSecurityMode.Optional,
17071707
) as sd:
17081708
con1 = await sd.connect()
1709+
1710+
# Shouldn't be anything in INSTANCE CONFIG, to start.
1711+
res = await con1.query_single('DESCRIBE INSTANCE CONFIG;')
1712+
self.assertEqual(res, '')
1713+
17091714
con2 = await sd.connect()
17101715

17111716
await con1.execute('''

0 commit comments

Comments
 (0)