Skip to content

Lobos quotes table and column names with H2 #62

@jsyrjala

Description

@jsyrjala

When Lobos creates tables, it seems to quote all table and column names with double quotes. This quoting makes the table and column names to be case sensitive. Probably Lobos should not quote table/column names.

(use 'clojure.java.jdbc)
(query conn ["SELECT * FROM INFORMATION_SCHEMA.TABLES 
     WHERE TABLE_SCHEMA = SCHEMA()"] :row-fn println)
{:last_modification 0, :table_catalog INTEGRATION_TESTS, :table_name users, :table_class org.h2.table.RegularTable, :table_type TABLE, :table_schema PUBLIC, :sql CREATE MEMORY TABLE PUBLIC."users"(
    "id" INTEGER DEFAULT (NEXT VALUE FOR PUBLIC.SYSTEM_SEQUENCE_52291230_D735_4D2A_B8B8_FD13D54854D1) NOT NULL NULL_TO_DEFAULT SEQUENCE PUBLIC.SYSTEM_SEQUENCE_52291230_D735_4D2A_B8B8_FD13D54854D1,
    "username" VARCHAR(256) NOT NULL,
    "password_hash" VARCHAR(256),
    "name" VARCHAR(128),
    "email" VARCHAR(256),
    "created_on" TIMESTAMP DEFAULT CURRENT_TIMESTAMP() NOT NULL,
    "updated_on" TIMESTAMP DEFAULT CURRENT_TIMESTAMP() NOT NULL
), :id 16, :type_name nil, :remarks , :storage_type MEMORY}
(query (api/db-conn) ["select * from public.users where id=1"])

JdbcSQLException Table "USERS" not found; SQL statement:
select * from public.users where id=1 [42102-171]  
org.h2.message.DbException.getJdbcSQLException (DbException.java:329)

(query (api/db-conn) ["select * from public.\"users\" where \"id\"=1"])
()   ;; query returns values

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions