Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Schema name is not necessary in SQL query if attach has specified a schema name. #265

Closed
2 tasks done
robotslacker opened this issue Sep 18, 2024 · 2 comments
Closed
2 tasks done

Comments

@robotslacker
Copy link

What happens?

With this commit 33598a6 , we now can attach to a specific schema instead of the entire target database, which helps us a lot. thanks a lot.

But since the schema parameter is supported, it becomes meaningless to require the schema name in query sel when accessing data.

attach "" as s (TYPE POSTGRES, SCHEMA schema1).

The expected behavior : select * from s.tab1;
Current behavior: select * from s.schema1.tab1;

To Reproduce

attach "" as s (TYPE POSTGRES, SCHEMA schema1).

OS:

Linux CentOS8

PostgreSQL Version:

15

DuckDB Version:

1.1.0

DuckDB Client:

jdbc

Full Name:

Shi.Zhao

Affiliation:

Oracle

Have you tried this on the latest main 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
@Mytherin
Copy link
Contributor

Thanks for the report!

The schema is already set as the default schema, so what you are suggesting is already the case, e.g.:

attach '' as s (type postgres);
select * from s.t;
-- Catalog Error: Table with name t does not exist!
-- Did you mean "s.s1.t"?
-- LINE 1: select * from s.t;
--                       ^
select * from s.s1.t;
┌───────┐
│   c   │
│ int32 │
├───────┤
│    42 │
└───────┘
detach s;
attach '' as s (type postgres, schema s1);
D select * from s.t;
┌───────┐
│   c   │
│ int32 │
├───────┤
│    42 │
└───────┘

Or am I missing something here?

@robotslacker
Copy link
Author

I tried it again and it seems to be just as you said.
I am confused and I don't understand what is going on.

Anyway, I should close this case first.
I am very sorry for the trouble.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants