Skip to content

export database can save views out of order breaking import. #8496

@ghost

Description

What happens?

views which reference other views can be saved out of order when the database is exported which prevents import database from succeeding as seen in the testcase below.

duckdb t.ddb -c 'create view b as select 1; create view a as select * from b;'
duckdb t.ddb -c "export database 'test'"
duckdb -c "import database 'test'"
Error: Catalog Error: Table with name b does not exist!
Did you mean "temp.information_schema.tables"?

looking at the generated schema.sql can see the views were reordered.

cat test/schema.sql
create view a as select * from b;
;
create view b as select 1
;

To Reproduce

duckdb t.ddb -c 'create view b as select 1; create view a as select * from b;'
duckdb t.ddb -c "export database 'test'"
duckdb -c "import database 'test'"

OS:

Ubuntu 22.04.3 LTS

DuckDB Version:

v0.8.2-dev2495

DuckDB Client:

cli

Full Name:

robert manchester

Affiliation:

unaffiliated

Have you tried this on the latest master branch?

I have tested with a master build

Have you tried the steps to reproduce? Do they include all relevant data and configuration? Does the issue you report still appear there?

  • Yes, I have

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions