[
https://issues.apache.org/jira/browse/IGNITE-8152?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17058636#comment-17058636
]
Andrey Mashenkov commented on IGNITE-8152:
------------------------------------------
[~Aleksei_Litsov], sorry, but your changes looks harmful. You add a hidden
behavior in SqlFieldsQuery.
# Run query with incorrect argument should lead to an error. User expects to
get an error instead of using _"default"_ schema.
Empty schema usually treated as _"current"_ schema in some other DB engines,
which is not the same as _"default"_ schema. _"Current"_ schema relates to a
session, but you have no "session" when you start query via API.
# Assume, user has two caches of similar structures, but for different
purposes. If user run same query on both caches in a manner described below
then he will got wrong results instead of error.
{code:java}
SqlFieldsQuery qry = new SqlFieldsQuery("...").setSchema("some_schema");
cache.query(qry);
qry.setSchema(" ");
cache.query(qry); // Will return results instead of error as query was started
with schema "some_"schema".{code}
3. SqlFieldsQuery is Serializable. It is still possible to create
SqlQueryFields with empty schema using old Ignite sources and start query on
newer nodes.
Though Ignite doesn't allow old client nodes to connect to grid of newer
version, but we must preserve public API compatibility while it is possible.
Let's avoid hidden behavior and either move this check to server side or throw
e.g. meaningful IllegalAgrumentException and make additional check on server
side.
> Forbid empty sql schema name
> ----------------------------
>
> Key: IGNITE-8152
> URL: https://issues.apache.org/jira/browse/IGNITE-8152
> Project: Ignite
> Issue Type: Improvement
> Components: sql
> Reporter: Pavel Kuznetsov
> Assignee: Alexey
> Priority: Major
> Labels: newbie
> Time Spent: 20m
> Remaining Estimate: 0h
>
> Currently we allow empty schema name (quoted) in cache configuration
> org.apache.ignite.configuration.CacheConfiguration#setSqlSchema :
> {noformat}
> When sqlSchema is not specified, quoted cacheName is used instead.
> sqlSchema could not be an empty string. Has to be "\"\"" instead.
> Params:
> sqlSchema - Schema name for current cache according to SQL ANSI-99. Should
> not be null.
> {noformat}
> Specifying schema \"\" results in empty string schema name.
> No schema in sql query is treated as PUBLIC, but \"\" is regular schema name.
> It's better to disallow usage of \"\" schema
--
This message was sent by Atlassian Jira
(v8.3.4#803005)