Return-Path: X-Original-To: apmail-db-derby-dev-archive@www.apache.org Delivered-To: apmail-db-derby-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id E0FE9CA2A for ; Thu, 7 Aug 2014 16:36:18 +0000 (UTC) Received: (qmail 4084 invoked by uid 500); 7 Aug 2014 16:36:18 -0000 Delivered-To: apmail-db-derby-dev-archive@db.apache.org Received: (qmail 4046 invoked by uid 500); 7 Aug 2014 16:36:18 -0000 Mailing-List: contact derby-dev-help@db.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: Delivered-To: mailing list derby-dev@db.apache.org Received: (qmail 3912 invoked by uid 99); 7 Aug 2014 16:36:18 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 07 Aug 2014 16:36:18 +0000 Date: Thu, 7 Aug 2014 16:36:18 +0000 (UTC) From: "ASF subversion and git services (JIRA)" To: derby-dev@db.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (DERBY-6693) Assert failure/ArrayIndexOutOfBoundsException when using COUNT in MERGE matching clause MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/DERBY-6693?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14089422#comment-14089422 ] ASF subversion and git services commented on DERBY-6693: -------------------------------------------------------- Commit 1616529 from [~dagw] in branch 'code/branches/10.11' [ https://svn.apache.org/r1616529 ] DERBY-6693 Assert failure/ArrayIndexOutOfBoundsException when using COUNT in MERGE matching clause Backported from trunk cleanly as: svn merge -c 1616523 https://svn.apache.org/repos/asf/db/derby/code/trunk The patch forbids aggregates in the matching clauses, and adds a test case to MergeStatementTest. > Assert failure/ArrayIndexOutOfBoundsException when using COUNT in MERGE matching clause > --------------------------------------------------------------------------------------- > > Key: DERBY-6693 > URL: https://issues.apache.org/jira/browse/DERBY-6693 > Project: Derby > Issue Type: Bug > Components: SQL > Affects Versions: 10.10.2.0 > Reporter: Dag H. Wanvik > Priority: Minor > Attachments: derby-6693.diff, derby-6693.status > > > This (meaningless) statement gives NPE in insane builds and > assert failure in sane builds: > {code} > s.execute("create table t2(x int)"); > s.execute("create table t1(x int)"); > s.execute("insert into t2 values 3,4"); > s.executeUpdate("merge into t1 using t2 on (t1.x=t2.x) " + > "when not matched then insert values (count(*))"); > {code} > I see it also applies to other aggregates, e.g. MAX. > stack trace (insane): > {code} > Exception in thread "main" java.sql.SQLException: Java exception: '-1: java.lang.ArrayIndexOutOfBoundsException'. > at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown Source) > at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown Source) > at org.apache.derby.impl.jdbc.Util.seeNextException(Unknown Source) > at org.apache.derby.impl.jdbc.Util.javaException(Unknown Source) > at org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(Unknown Source) > at org.apache.derby.impl.jdbc.TransactionResourceImpl.handleException(Unknown Source) > at org.apache.derby.impl.jdbc.EmbedConnection.handleException(Unknown Source) > at org.apache.derby.impl.jdbc.ConnectionChild.handleException(Unknown Source) > at org.apache.derby.impl.jdbc.EmbedStatement.execute(Unknown Source) > at org.apache.derby.impl.jdbc.EmbedStatement.executeLargeUpdate(Unknown Source) > at org.apache.derby.impl.jdbc.EmbedStatement.executeUpdate(Unknown Source) > at derby6565.Derby6565.main(Derby6565.java:46) > Caused by: ERROR XJ001: Java exception: '-1: java.lang.ArrayIndexOutOfBoundsException'. > at org.apache.derby.iapi.error.StandardException.newException(Unknown Source) > at org.apache.derby.impl.jdbc.SQLExceptionFactory.wrapArgsForTransportAcrossDRDA(Unknown Source) > ... 12 more > Caused by: java.lang.ArrayIndexOutOfBoundsException: -1 > at org.apache.derby.impl.services.bytecode.BCMethod.popStack(Unknown Source) > at org.apache.derby.impl.services.bytecode.BCMethod.callMethod(Unknown Source) > at org.apache.derby.impl.sql.compile.ResultColumnList.generateEvaluatedRow(Unknown Source) > at org.apache.derby.impl.sql.compile.MatchingClauseNode.generateInsertUpdateRow(Unknown Source) > at org.apache.derby.impl.sql.compile.MatchingClauseNode.generate(Unknown Source) > at org.apache.derby.impl.sql.compile.MergeNode.generate(Unknown Source) > at org.apache.derby.impl.sql.compile.StatementNode.generate(Unknown Source) > at org.apache.derby.impl.sql.GenericStatement.prepMinion(Unknown Source) > at org.apache.derby.impl.sql.GenericStatement.prepare(Unknown Source) > at org.apache.derby.impl.sql.conn.GenericLanguageConnectionContext.prepareInternalStatement(Unknown Source) > ... 4 more > {code} -- This message was sent by Atlassian JIRA (v6.2#6252)