ignite-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Vladimir Ozerov (JIRA)" <j...@apache.org>
Subject [jira] [Resolved] (IGNITE-3792) Wrap table and column names with escape characters in generated H2 SQL queries
Date Fri, 10 Nov 2017 08:07:00 GMT

     [ https://issues.apache.org/jira/browse/IGNITE-3792?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel

Vladimir Ozerov resolved IGNITE-3792.
    Resolution: Won't Fix

Please use {{CacheConfiguration.sqlEscapeAll}} flag. It was introduced exactly for this purpose.

> Wrap table and column names with escape characters in generated H2 SQL queries
> ------------------------------------------------------------------------------
>                 Key: IGNITE-3792
>                 URL: https://issues.apache.org/jira/browse/IGNITE-3792
>             Project: Ignite
>          Issue Type: Bug
>          Components: sql
>            Reporter: Igor Rudyak
> Sometimes user can specify SQL reserved word as a class name (or as a class member name)
for objects stored in Ignite cache. In such cases current implementation will fail to create
H2 table and start Ignite cluster. 
> For example, if I have a system which registers purchase orders and I called my custom
class *Order* (which is reserved SQL keyword), I'll have such an error while trying to start
Ignite cluster with *aaa* cache configured to store my *Order* objects:
> Caused by: org.h2.jdbc.JdbcSQLException: Syntax error in SQL statement "CREATE TABLE
INT,PRICE REAL) ENGINE ""org.apache.ignite.internal.processors.query.h2.opt.GridH2Table$Engine""
"; expected "identifier"; SQL statement:
> CREATE TABLE "aaa".Order (_key BIGINT NOT NULL,_val OTHER,id BIGINT,productId BIGINT,date
TIMESTAMP,amount INT,price REAL) engine "org.apache.ignite.internal.processors.query.h2.opt.GridH2Table$Engine"
> At the same time, renaming *Order* class to something which is not SQL reserved keyword
solves the problem, but from the object model design perspective looks not very good - cause
*Order* class name reflects the main idea of the class.
> To prevent the problem, it's necessary to wrap table and column names with escape characters
(double quotes) in generated SQL statements (which was done for cache name, but for some reason
wasn't done for table name).

This message was sent by Atlassian JIRA

View raw message