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

SQL: Table name identifiers should be normalized to lowercase unless quoted #1771

Closed
mkmik opened this issue Feb 7, 2022 · 2 comments
Closed
Labels
bug Something isn't working

Comments

@mkmik
Copy link
Contributor

mkmik commented Feb 7, 2022

Describe the bug

Since we claim postgresql dialect compatibility, table identifiers in SQL should be normalized to lowercase unless quoted.

To Reproduce

> create table t1 as select * from (values (11, 'a')) as sq;
> select column1 from T1;
Plan("Table or CTE with name 'T1' not found")

Expected behavior

> create table t1 as select * from (values (11, 'a')) as sq;
> select column1 from T1;
+---------+
| column1 |
+---------+
| 11      |
+---------+
> select column1 from "T1";
Plan("Table or CTE with name 'T1' not found")
@mkmik mkmik added the bug Something isn't working label Feb 7, 2022
@mkmik mkmik changed the title SQ: Table name identifiers should be normalized to lowercase unless quoted SQL: Table name identifiers should be normalized to lowercase unless quoted Feb 7, 2022
@jackwener
Copy link
Member

It seems that it's resolved, we can close it.

select * from information_schema.TaBleS;
+---------------+--------------------+------------+------------+
| table_catalog | table_schema       | table_name | table_type |
+---------------+--------------------+------------+------------+
| datafusion    | information_schema | tables     | VIEW       |
| datafusion    | information_schema | columns    | VIEW       |
+---------------+--------------------+------------+------------+

@houqp houqp closed this as completed Mar 14, 2022
@mkmik
Copy link
Contributor Author

mkmik commented Mar 14, 2022

(please re-open)

I re-ran the reproducer above and the issue still reproduces at current master (ca952bd).

❯ create table t1 as select * from (values (11, 'a')) as sq;
0 rows in set. Query took 0.021 seconds.
❯ select column1 from T1;
Plan("Table or CTE with name 'T1' not found")

Is information_schema.TaBlEs lowercased because it's a special schema or could it be because it's a view?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants