Return-Path: Delivered-To: apmail-db-derby-dev-archive@www.apache.org Received: (qmail 21034 invoked from network); 8 Jun 2006 18:59:37 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 8 Jun 2006 18:59:37 -0000 Received: (qmail 63200 invoked by uid 500); 8 Jun 2006 18:59:36 -0000 Delivered-To: apmail-db-derby-dev-archive@db.apache.org Received: (qmail 63160 invoked by uid 500); 8 Jun 2006 18:59:36 -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 63029 invoked by uid 99); 8 Jun 2006 18:59:36 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 08 Jun 2006 11:59:36 -0700 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received: from [209.237.227.198] (HELO brutus.apache.org) (209.237.227.198) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 08 Jun 2006 11:59:35 -0700 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 89D5C7142CC for ; Thu, 8 Jun 2006 18:58:31 +0000 (GMT) Message-ID: <6226543.1149793111561.JavaMail.jira@brutus> Date: Thu, 8 Jun 2006 18:58:31 +0000 (GMT+00:00) From: "Satheesh Bandaram (JIRA)" To: derby-dev@db.apache.org Subject: [jira] Updated: (DERBY-1329) ASSERT failure/IndexOutOfBoundsException with correlated subquery for UPDATE ... SET ... WHERE CURRENT OF ... statement. In-Reply-To: <31425795.1147803547135.JavaMail.jira@brutus> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N [ http://issues.apache.org/jira/browse/DERBY-1329?page=all ] Satheesh Bandaram updated DERBY-1329: ------------------------------------- Derby Info: (was: [Patch Available]) Submitted this patch to 10.1 branch. Please resolve and/or close accordingly. > ASSERT failure/IndexOutOfBoundsException with correlated subquery for UPDATE ... SET ... WHERE CURRENT OF ... statement. > ------------------------------------------------------------------------------------------------------------------------ > > Key: DERBY-1329 > URL: http://issues.apache.org/jira/browse/DERBY-1329 > Project: Derby > Type: Bug > Components: SQL > Versions: 10.0.2.0, 10.0.2.1, 10.1.1.0, 10.2.0.0, 10.1.2.0, 10.1.1.1, 10.1.1.2, 10.1.2.1, 10.1.2.2, 10.1.2.3, 10.1.2.4 > Reporter: A B > Assignee: A B > Priority: Minor > Fix For: 10.2.0.0, 10.1.3.0 > Attachments: d1329.java, d1329.patch, d1329_10_1.patch > > If in a statement of the form "UPDATE ... SET ... WHERE CURRENT OF ..." the SET clause includes a correlated subquery that has a predicate referencing the table that is being updated, Derby will fail with an ASSERT failure in sane mode and an IndexOutOfBounds exception in insane mode. > For example, if we have a cursor CUR1 for the results of a SELECT query on BASICTABLE1, and then we try to execute the following update statement: > update BASICTABLE1 set C3 = (SELECT CC3 FROM > BASICTABLE2 WHERE BASICTABLE1.ID=BASICTABLE2.IID) > where current of CUR1 > the result in SANE mode will be: > org.apache.derby.shared.common.sanity.AssertFailure: ASSERT FAILED tableNumber is expected to be non-negative. > and in INSANE mode will be: > java.lang.IndexOutOfBoundsException: bitIndex < 0: -1 > The failure occurs during preprocessing of the subquery node when Derby is trying to "categorize" a predicate to see if it is pushable. The exact code is in ColumnReference.categorize(): > public boolean categorize(JBitSet referencedTabs, boolean simplePredsOnly) > { > if (SanityManager.DEBUG) > SanityManager.ASSERT(tableNumber >= 0, > "tableNumber is expected to be non-negative"); > referencedTabs.set(tableNumber); > return ( ! replacesAggregate ) && > ( (source.getExpression() instanceof ColumnReference) || > (source.getExpression() instanceof VirtualColumnNode) || > (source.getExpression() instanceof ConstantNode)); > } > We get to this code for a ColumnReference who's tableNumber is -1, which means that, in sane mode, the assert will fire; in insane mode, we'll call "referencedTabs.set()" passing in a -1, which leads to the IndexOutOfBoundsException. > This failure occurs in embedded and with both clients, and occurs in 10.0, 10.1, and the 10.2 trunk. -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira