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

show create table doesn't work for numbers #3980

Closed
sunng87 opened this issue May 17, 2024 · 6 comments · Fixed by #4099
Closed

show create table doesn't work for numbers #3980

sunng87 opened this issue May 17, 2024 · 6 comments · Fixed by #4099
Assignees
Labels
C-enhancement Category Enhancements good first issue Good for newcomers

Comments

@sunng87
Copy link
Member

sunng87 commented May 17, 2024

What type of bug is this?

Incorrect result

What subsystems are affected?

Table Engine

Minimal reproduce step

just run sql show create table numbers

What did you expect to see?

sql statement for creating this table

What did you see instead?

"Failed to find table route: 2"

What operating system did you use?

any

What version of GreptimeDB did you use?

HEAD

Relevant log output and stack trace

No response

@sunng87 sunng87 added the C-bug Category Bugs label May 17, 2024
@tisonkun
Copy link
Contributor

This is somehow not a bug. Because the numbers table is an internal immutable table and there is no way to create from user space.

However, we'd think of #1827 again.

@tisonkun tisonkun added C-enhancement Category Enhancements and removed C-bug Category Bugs labels May 18, 2024
@sunng87
Copy link
Member Author

sunng87 commented May 18, 2024

Actually using sql show create table is not for creating table but to see its definition and metadata. I think any table, or table-like object, that shows up in show tables and information_schema.tables should provide this ability.

Imagine that when you show table it says there is a table, but when you run show create table it says "failed to find table route", which sounds like an equivalent to "table not found".

@killme2008
Copy link
Contributor

We can check the table type, it must be the Base type to show the table definition.

Checking the table type in show_create_table and return an error if it's not Base type.

) -> Result<Output> {

It's a good first issue. Let me label it.

@killme2008 killme2008 added the good first issue Good for newcomers label May 30, 2024
@sunng87
Copy link
Member Author

sunng87 commented May 30, 2024

I think we still need a solution to return show create table content for non-Base type.

Because the table type is never exposed to user. The user won't have chance to know if a table is capable for show create table

@killme2008
Copy link
Contributor

killme2008 commented May 30, 2024

We'll have other statements to support other table types, such as show create view or show create flow.

We already have #3939 to track show create flow.

@killme2008
Copy link
Contributor

If you want to know the table metadata, you can use desc table [table].
The show create table is mainly used to get the sql definition of the table and can be used to execute it directly by users.

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

Successfully merging a pull request may close this issue.

3 participants