You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ignite.apache.org by "Alexander Paschenko (JIRA)" <ji...@apache.org> on 2017/09/05 12:44:00 UTC
[jira] [Commented] (IGNITE-6111) SQL: Add ability to do INSERT
without specifying the column names
[ https://issues.apache.org/jira/browse/IGNITE-6111?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16153578#comment-16153578 ]
Alexander Paschenko commented on IGNITE-6111:
---------------------------------------------
It fails because H2, when parsing an {{INSERT}} and doing columns count check, treats case with no explicit columns as one concerning ALL columns, i.e. including invisible ones ({{_key}}, {{_val}}, {{_ver}} in case of Ignite), which user does not give values for - that's why column numbers are different.
Error is thrown from H2's {{org.h2.command.dml.Insert}}, line 265 (true for version 1.4.195), there's following code
{code}
for (Expression[] expr : list) {
if (expr.length != columns.length) {
throw DbException.get(ErrorCode.COLUMN_COUNT_DOES_NOT_MATCH);
}
{code}
{{columns}} if the field containing all cols that this {{INSERT}} statement aims to update, and its value is set just few lines above - it deliberately contains all table's columns and that probably needs to change.
> SQL: Add ability to do INSERT without specifying the column names
> -----------------------------------------------------------------
>
> Key: IGNITE-6111
> URL: https://issues.apache.org/jira/browse/IGNITE-6111
> Project: Ignite
> Issue Type: Task
> Components: sql
> Affects Versions: 2.1
> Reporter: Alexandr Fedotov
> Assignee: Sergey Kalashnikov
> Labels: sql, usability
> Fix For: 2.3
>
>
> Having the following classes
> {code:java}
> class PersonKey {
> private Long id;
> }
> class Person {
> private Long id;
> private String name;
> }
> {code}
> with proper configuration it should be possible to execute queries
> of the following type passing {{id}} and {{name}} as the arguments
> {code:sql}"insert into Person values(?,?)"{code}
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)