You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
SQL column identifiers should be converted to lowercase when unquoted #1746
In PostgreSQL all column name identifiers are turned into lowercase, unless they are quoted. Example:
tmp1=> create table blah (Foo int, "Foo" int, "Bar" int);
CREATE TABLE
tmp1=> \d blah
Table "public.blah"
Column | Type | Collation | Nullable | Default
--------+---------+-----------+----------+---------
foo | integer | | |
Foo | integer | | |
Bar | integer | | |
tmp1=> insert into blah values (1,2,3);
INSERT 0 1
tmp1=> select foo, Foo, "Foo", "Bar" from blah;
foo | foo | Foo | Bar
-----+-----+-----+-----
1 | 1 | 2 | 3
(1 row)
tmp1=> select Bar from blah;
ERROR: column "bar" does not exist
LINE 1: select Bar from blah;
^
HINT: Perhaps you meant to reference the column "blah.Bar".
PostgreSQL converts to lowercase all column identifiers. The example above shows how Foo used in the DDL statement creates a column actually named foo and it shows how it can be accessed in a query with Foo (unquoted). An actual "Foo" column happily coexist with foo in the table, but must be referenced with a quoted "Foo"
In Datafusion currently Bar means the same as "Bar" (I'm not providing a screen dump of the current datafusion behaviour out of laziness, I may add it later if turns out to be useful for the discussion).
Describe the solution you'd like
select FoO from my_table;
should be equivalent to
select foo from my_table;
If users want to access a column that is not in lower case, they should explicitly quote the column:
Activity
mkmik commentedon Feb 7, 2022
I mislabeled this as a feature request; I think it should be tracked as a bug.
CC: @alamb
alamb commentedon Feb 7, 2022
Changed -- thanks