Skip to content

SQL: Case-insensitive unquoted identifiers #6066

@philrz

Description

@philrz

In SuperDB, an unquoted identifier of mixed case is not currently matching against a lowercase column name, but if we're following Postgres SQL behaviors, it seems that it should.

Details

Repro is with super commit 1201d20.

The relevant Postgres docs say:

Key words and unquoted identifiers are case-insensitive.

An example of this is how the SELECT Hello used below still matches the column name hello.

$ psql postgres
psql (17.5 (Homebrew))
Type "help" for help.

postgres=# CREATE TABLE foo ("hello" VARCHAR);
CREATE TABLE
postgres=# INSERT INTO foo("hello") VALUES('world');
INSERT 0 1

postgres=# SELECT * FROM foo;
 hello 
-------
 world
(1 row)

postgres=# SELECT Hello FROM foo;
 hello 
-------
 world
(1 row)

Whereas in SuperDB:

$ super -version
Version: 1201d205e

$ echo '{"hello": "world"}' > foo.json &&
  super -c "SELECT * FROM 'foo.json';"

{hello:"world"}

$ super -c "SELECT Hello FROM 'foo.json';"
column "Hello": does not exist at line 1, column 8:
SELECT Hello FROM 'foo.json';
       ~~~~~

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions