alamb commented on issue #1710:
URL:
https://github.com/apache/arrow-datafusion/issues/1710#issuecomment-1029927443
Yes, Arrow schema's are case sensitive and SQL itself has stranger semantics
for case insensitive
Here is an example from postgres showing how SQL interprets mixed case
identifiers. Basically if the identifier is not double quoted, it is is simply
lower cased prior to processing
```sql
create table bar ("foo" int, "Foo" int, "FoO" int);
CREATE TABLE
alamb=# insert into bar values (1,2,3);
INSERT 0 1
alamb=# select * from bar;
foo | Foo | FoO
-----+-----+-----
1 | 2 | 3
(1 row)
alamb=# select foo from bar;
foo
-----
1
(1 row)
-- Note result has foo, not Foo
alamb=# select Foo from bar;
foo
-----
1
(1 row)
alamb=# select "Foo" from bar;
Foo
-----
2
(1 row)
```
`foo` always matches the lower case column name `"foo"` even when it is not
the first column
```sql
alamb=# create table baz("Foo" int, foo int);
CREATE TABLE
alamb=# insert into baz values (100,200);
INSERT 0 1
alamb=# select foo from baz;
foo
-----
200
(1 row)
```
If you create a table, the identifier is also lower cased at create time
```
alamb=# create table blarg(Foo int);
CREATE TABLE
alamb=# select * from blarg;
foo
-----
(0 rows)
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]