Skip to content

Setting the current schema should not change the current database (or should it?) #7567

@bleskes

Description

@bleskes

What happens?

In the current multi-attach world, a user can set the database they want to default to when not specifying the database they mean (USE def_catalog). Similarly, users could change the default schema by using set schema=def_schema. Sadly, this updates the search path with "","def_schema" and overrides the catalog part. I would expect "def_catalog","def_schema" to be added.

Finally enough, the code for validating the input of the set schema command does resolve using the current default database (which is how it finds the schema) but then it "forgets".

To Reproduce

~/src/md/duckdb (master) » ./build/debug/duckdb                                                                                                                                     boaz@boaz-air
v0.7.2-dev3786 6e908cfc55
Enter ".help" for usage hints.
Connected to a transient in-memory database.
Use ".open FILENAME" to reopen on a persistent database.
D attach ':memory:' as test;
D use test;
D create schema schema1;
D create table schema1.table1 as select 1 as a;
D set schema='schema1';
D select * from table1;
Error: Catalog Error: Table with name table1 does not exist!
Did you mean "test.schema1.table1"?
LINE 1: select * from table1;

OS:

MacOS

DuckDB Version:

master

DuckDB Client:

cli

Full Name:

Boaz Leskes

Affiliation:

MotherDuck

Have you tried this on the latest master branch?

  • I agree

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

  • I agree

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions