-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Table names with periods are not handled correctly #4513
Comments
I believe the issue is that this code does not handle |
I am actively working on this issue |
hi @alamb i tried to add this if s.len() >= 2 && s.chars().nth(0) == Some('"') && s.chars().last() == Some('"') {
return Self::Bare {table: s}
} to return the whole double quoted string before and it works while creating a new table ❯ create table "foo.bar" as values (1), (2);
0 rows in set. Query took 0.001 seconds.
❯ show tables;
+---------------+--------------------+-------------+------------+
| table_catalog | table_schema | table_name | table_type |
+---------------+--------------------+-------------+------------+
| datafusion | public | "foo.bar" | BASE TABLE |
| datafusion | information_schema | tables | VIEW |
| datafusion | information_schema | views | VIEW |
| datafusion | information_schema | columns | VIEW |
| datafusion | information_schema | df_settings | VIEW |
+---------------+--------------------+-------------+------------+
6 rows in set. Query took 0.003 seconds. but failed to select it ❯ select * from "foo.bar";
Plan("failed to resolve schema: foo") |
@alamb ❯ create table 'foo' as values (1), (2);
0 rows in set. Query took 0.001 seconds. i'm not sure whether this is expected ❯ show tables;
s information_schema.tables
+---------------+--------------------+-------------+------------+
| table_catalog | table_schema | table_name | table_type |
+---------------+--------------------+-------------+------------+
| datafusion | public | 'foo' | BASE TABLE |
| datafusion | information_schema | tables | VIEW |
| datafusion | information_schema | views | VIEW |
| datafusion | information_schema | columns | VIEW |
| datafusion | information_schema | df_settings | VIEW |
+---------------+--------------------+-------------+------------+ as postgresql doesn't support it willy=# create table 'foo' as values (1), (2);
ERROR: syntax error at or near "'foo'"
LINE 1: create table 'foo' as values (1), (2); |
I have a fix for this partially coded -- I'll get it up shortly |
Proposed PR to fix: #4530 |
Describe the bug
We have a customer with a table whose name contains a period
In SQL you can refer to such tables using double quotes
"foo.bar"
. Note this is different thanfoo.bar
which means table namedbar
in the schema namedfoo
.You can see how this works in postgres:
Expected behavior
DataFusion should treat
"foo.bar"
as a table named foo.bar like SQL / postgresAdditional context
Add any other context about the problem here.
The text was updated successfully, but these errors were encountered: