Skip to content

Commit cb47611

Browse files
authored
Fix inplace upgrade config updates (#9116)
IPUs currently sometimes break if new config fields have been added in both the base schema and extension schemas. This is because the IPU path calls get_existing_view_columns to make sure that columns are ordered correctly, but get_existing_view_columns does not restrict the query to only inspecting tables for the *current* version, and so gets confused when both exist during the IPU.
1 parent 732a3f7 commit cb47611

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

edb/server/bootstrap.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -716,7 +716,8 @@ async def get_existing_view_columns(
716716
# Find all the config views (they are pg_classes where
717717
# there is also a table with the same name but "_dummy"
718718
# at the end) and collect all their columns in order.
719-
return json.loads(await conn.sql_fetch_val('''\
719+
schema = pg_common.versioned_schema("edgedbstd")
720+
return json.loads(await conn.sql_fetch_val(f'''\
720721
select json_object_agg(v.relname, (
721722
select json_agg(a.attname order by a.attnum)
722723
from pg_catalog.pg_attribute as a
@@ -725,6 +726,10 @@ async def get_existing_view_columns(
725726
from pg_catalog.pg_class as v
726727
inner join pg_catalog.pg_tables as t
727728
on v.relname || '_dummy' = t.tablename
729+
-- Filter for just our namespace!
730+
inner join pg_catalog.pg_namespace as ns
731+
on v.relnamespace = ns.oid
732+
where ns.nspname = '{schema}' OR ns.nspname = 'edgedbpub'
728733
729734
'''.encode('utf-8')))
730735

0 commit comments

Comments
 (0)