geldata / geldata/gel-cli

Edgedb dump -> restore onto non-empty database with only extensions isn't rejected

Open
#1,310 5 comments 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
175
Forks
32
PR merge metrics
No merged PRs in 30d

Description

- 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:
1. create a new empty instance
2. run `edgedb dump ./dump.bin`
3. run `edgedb restore dump.bin`
above steps should work as expected

5. add a `using extension ..` to the schema and migrate the database
6. 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
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
```

Schema:
```
using extension edgeql_http;

module default {

}
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.