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

Feature: Support USE CATALOG syntax and current_catalog() function #16848

Open
b41sh opened this issue Nov 15, 2024 · 1 comment · May be fixed by #16926
Open

Feature: Support USE CATALOG syntax and current_catalog() function #16848

b41sh opened this issue Nov 15, 2024 · 1 comment · May be fixed by #16926
Assignees
Labels
C-feature Category: feature good first issue Category: good first issue

Comments

@b41sh
Copy link
Member

b41sh commented Nov 15, 2024

Summary

  • Support USE CATALOG catalog_name to set the current catalog.
  • Support current_catalog() function to get the current catalog.

After the current catalog is set, user can use the table_name directly in the query without specifying catalog_name and database_name.

for example

root@0.0.0.0:8000/default> select * from my_catalog.my_database.my_table;
root@0.0.0.0:8000/default> select current_catalog();
┌───────────────────┐
│ current_catalog() │
│       String      │
├───────────────────┤
│ default           │
└───────────────────┘

# set current catalog and current database
root@0.0.0.0:8000/default> use catalog my_catalog;
root@0.0.0.0:8000/default> use my_database;
root@0.0.0.0:8000/default> select * from my_table;

root@0.0.0.0:8000/default> select current_catalog();
┌───────────────────┐
│ current_catalog() │
│       String      │
├───────────────────┤
│ my_catalog        │
└───────────────────┘
@b41sh b41sh added C-feature Category: feature good first issue Category: good first issue labels Nov 15, 2024
@flashmouse
Copy link

please let me try implement this @b41sh

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-feature Category: feature good first issue Category: good first issue
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants