mkmik opened a new issue #1746:
URL: https://github.com/apache/arrow-datafusion/issues/1746


   **Is your feature request related to a problem or challenge? Please describe 
what you are trying to do.**
   
   > DataFusion strives to implement a subset of the [PostgreSQL SQL 
dialect](https://www.postgresql.org/docs/current/functions.html) where possible
   
   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:
   
   ```
   select "FoO" from my_table;
   ```
   
   


-- 
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: github-unsubscr...@arrow.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to