Edgedb dump -> restore onto non-empty database with only extensions isn't rejected
- EdgeDB Version: 1.3+5d0197d
- OS Version: Windows 10
When dumping a database whos schema uses an extension, the returned binary file cannot be used to restore.
Steps to Reproduce:
-
create a new empty instance
-
run
edgedb dump ./dump.bin -
run
edgedb restore dump.binabove steps should work as expected -
add a
using extension ..to the schema and migrate the database -
run step 2 and 3
with testing this im using the edgeql_http extension
Retuned error
edgedb error: SchemaError: error initiating restore protocol: Extension ('cb78b832-d624-11ec-b010-f3789a0548ba') is already present in the schema <FlatSchema gen:2 at 0x7f7c9395ff40>
Server traceback:
Traceback (most recent call last):
File "/home/edgedb/.local/share/edgedb/portable/1.4/lib/python3.10/site-packages/edb/server/compiler_pool/worker.py", line 309, in worker
res = meth(*args)
File "/home/edgedb/.local/share/edgedb/portable/1.4/lib/python3.10/site-packages/edb/server/compiler/compiler.py", line 2450, in describe_database_restore
units = self._compile(ctx=ctx, source=ddl_source)
File "/home/edgedb/.local/share/edgedb/portable/1.4/lib/python3.10/site-packages/edb/server/compiler/compiler.py", line 1667, in _compile
return self._try_compile(ctx=ctx, source=source)
File "/home/edgedb/.local/share/edgedb/portable/1.4/lib/python3.10/site-packages/edb/server/compiler/compiler.py", line 1720, in _try_compile
comp, capabilities = self._compile_dispatch_ql(
File "/home/edgedb/.local/share/edgedb/portable/1.4/lib/python3.10/site-packages/edb/server/compiler/compiler.py", line 1614, in _compile_dispatch_ql
self._compile_and_apply_ddl_stmt(ctx, ql, source=source),
File "/home/edgedb/.local/share/edgedb/portable/1.4/lib/python3.10/site-packages/edb/server/compiler/compiler.py", line 793, in _compile_and_apply_ddl_stmt
delta = s_ddl.delta_from_ddl(
File "/home/edgedb/.local/share/edgedb/portable/1.4/lib/python3.10/site-packages/edb/schema/ddl.py", line 581, in delta_from_ddl
_, cmd = _delta_from_ddl(
File "/home/edgedb/.local/share/edgedb/portable/1.4/lib/python3.10/site-packages/edb/schema/ddl.py", line 628, in _delta_from_ddl
schema = cmd.apply(schema, context)
File "/home/edgedb/.local/share/edgedb/portable/1.4/lib/python3.10/site-packages/edb/schema/delta.py", line 2977, in apply
schema = self._create_begin(schema, context)
File "/home/edgedb/.local/share/edgedb/portable/1.4/lib/python3.10/site-packages/edb/schema/delta.py", line 2878, in _create_begin
schema, self.scls = metaclass.create_in_schema(schema, **props)
File "/home/edgedb/.local/share/edgedb/portable/1.4/lib/python3.10/site-packages/edb/schema/objects.py", line 1131, in create_in_schema
schema = schema.add(id, cls, tuple(obj_data))
File "/home/edgedb/.local/share/edgedb/portable/1.4/lib/python3.10/site-packages/edb/schema/schema.py", line 1558, in add
self._top_schema.add(id, sclass, data),
File "/home/edgedb/.local/share/edgedb/portable/1.4/lib/python3.10/site-packages/edb/schema/schema.py", line 963, in add
return self.add_raw(id, sclass, data)
File "/home/edgedb/.local/share/edgedb/portable/1.4/lib/python3.10/site-packages/edb/schema/schema.py", line 910, in add_raw
raise errors.SchemaError(
edb.errors.SchemaError: Extension ('cb78b832-d624-11ec-b010-f3789a0548ba') is already present in the schema <FlatSchema gen:2 at 0x7f7c9395ff40>
Schema:
using extension edgeql_http;
module default {
}
Hmm. Is there a chance you're restoring into a non-empty database? The bug seems to be that the CLI fails to recognize that the schema is non-empty.
running the above steps on a clean empty database causes the error so I don't think so
I couldn't reproduce. Steps (as written) attempt restore twice into the same db, no?
yes
I think that Elvis is correct here: the second restore is trying to restore onto a non-empty database, which I think we typically try to reject in the CLI.