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

Illegal SchemaNameKey format: '__schema_name/greptime/'illegal-database'' #2595

Closed
waynexia opened this issue Oct 12, 2023 · 3 comments · Fixed by #2719
Closed

Illegal SchemaNameKey format: '__schema_name/greptime/'illegal-database'' #2595

waynexia opened this issue Oct 12, 2023 · 3 comments · Fixed by #2719
Assignees
Labels
C-bug Category Bugs good first issue Good for newcomers help wanted Extra attention is needed

Comments

@waynexia
Copy link
Member

waynexia commented Oct 12, 2023

What type of bug is this?

Incorrect result

What subsystems are affected?

Standalone mode

What happened?

- is not supported in catalog/schema name. Quote it in CREATE DATABASE can bypass this limit. But it will breaks other internal components

What operating system did you use?

Arch Linux with Kernel: 6.3.5-arch1-1

Relevant log output and stack trace

MySQL [(none)]> show databases;
ERROR 1815 (HY000): Invalid table metadata, err: Illegal SchemaNameKey format: '__schema_name/greptime/'illegal-database''

Expected behavior

SHOW DATABASES works and can give the correct result.

How can we reproduce the bug?

show databases;
create database illegal-database;
create database 'illegal-database';
show databases;
@waynexia waynexia added the C-bug Category Bugs label Oct 12, 2023
@WenyXu WenyXu added good first issue Good for newcomers help wanted Extra attention is needed labels Oct 18, 2023
@tisonkun
Copy link
Collaborator

tisonkun commented Nov 9, 2023

@waynexia so what is the expected manner?

  • Disallow "illegal character" even if it's quoted; or,
  • Support such characters internally.

BTW, perhaps we can add such a section in the bug report issue template (what is expected) >_< (FYI - #2716)

@waynexia
Copy link
Member Author

waynexia commented Nov 9, 2023

@waynexia so what is the expected manner?

Updated to the issue description. Under Expected behavior section

@tisonkun
Copy link
Collaborator

tisonkun commented Nov 9, 2023

The issue is not about -, but the extra ':

mysql> create database 'illegaldatabase';
Query OK, 1 row affected (0.01 sec)

mysql> show databases;
ERROR 1815 (HY000): Invalid table metadata, err: Illegal SchemaNameKey format: '__schema_name/greptime/'illegaldatabase''
mysql> 

The NAME_PATTERN actually allows - but not ':

const NAME_PATTERN: &str = r"[a-zA-Z_:-][a-zA-Z0-9_:\-\.]*";

I don't think we should allow ' but try to trim it somewhere.

I'll try to dig it a bit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category Bugs good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants