Skip to content

Commit 3a9c423

Browse files
committed
Fix inplace upgrade config updates
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 d6f0fbe commit 3a9c423

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
@@ -713,7 +713,8 @@ async def get_existing_view_columns(
713713
# Find all the config views (they are pg_classes where
714714
# there is also a table with the same name but "_dummy"
715715
# at the end) and collect all their columns in order.
716-
return json.loads(await conn.sql_fetch_val('''\
716+
schema = pg_common.versioned_schema("edgedbstd")
717+
return json.loads(await conn.sql_fetch_val(f'''\
717718
select json_object_agg(v.relname, (
718719
select json_agg(a.attname order by a.attnum)
719720
from pg_catalog.pg_attribute as a
@@ -722,6 +723,10 @@ async def get_existing_view_columns(
722723
from pg_catalog.pg_class as v
723724
inner join pg_catalog.pg_tables as t
724725
on v.relname || '_dummy' = t.tablename
726+
-- Filter for just our namespace!
727+
inner join pg_catalog.pg_namespace as ns
728+
on v.relnamespace = ns.oid
729+
where ns.nspname = '{schema}' OR ns.nspname = 'edgedbpub'
725730
726731
'''.encode('utf-8')))
727732

0 commit comments

Comments
 (0)