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 B1BD4118F8 for ; Thu, 18 Sep 2014 03:53:34 +0000 (UTC) Received: (qmail 20323 invoked by uid 500); 18 Sep 2014 03:53:34 -0000 Delivered-To: apmail-db-derby-dev-archive@db.apache.org Received: (qmail 20295 invoked by uid 500); 18 Sep 2014 03:53:34 -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 20088 invoked by uid 99); 18 Sep 2014 03:53:34 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 18 Sep 2014 03:53:34 +0000 Date: Thu, 18 Sep 2014 03:53:34 +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-6743) MERGE code needs changes since now UPDATE statement can change the identity column value using DEFAULT keyword. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/DERBY-6743?page=3Dcom.atlassian= .jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=3D1413= 8456#comment-14138456 ]=20 ASF subversion and git services commented on DERBY-6743: -------------------------------------------------------- Commit 1625884 from [~mamtas] in branch 'code/trunk' [ https://svn.apache.org/r1625884 ] CERBY-6414(Incorrect handling when using an UPDATE to SET an identity colum= n to DEFAULT) I have created DERBY-6742 for JDBC part of this feature so we can generate = auto generated resultset for an update statement updating generated columns= . This implementation is supported through Statement.RETURN_GENERATED_KEYS = flag. Junit tests for this feature are in GeneratedColumnsTest.java. Upgrade test= s are in Changes10_12.java. Upgrade test shows that a soft upgrade from pre= -10.11 will not support update of generated columns using DEFAULT but 10.11= to trunk soft upgrade will allow it. This is because starting 10.11, we ha= ve started using sequence generator to create unique ids. If we want to sup= port updating of idetity columns for pre-10.11 releases, we will need to ma= intain the code for old way of generating unique ids. In order to avoid tha= t, this feature is available to only 10.11 db during soft upgrade. For UPDATE of identity column to work in the MERGE sql, we need to make cha= nges to MERGE code(DERBY-6743). MERGE already has required code for insert = putting DEFAULT in generated columns. Implementation needs to be added for = update putting DEFAULT in generated columns in case of MERGE. In the mean t= ime, I have renamed existing junit test test_015_bug_6414 to atest_015_bug_= 6414 in MergeStatementTest.java so we do not run into failures. Some detail about the part of the implementation that was tricky for DERBY-= 6414. The existing code was originally written to handle inserting values in iden= tity columns using DEFAULT. In case of insert, InsertResultSet uses ColumnD= escriptors in resultDescription to find the type of the generated columns. = This data structure holds the column descriptors of all the columns in the = table. All the columns are in this data structure because even though INSER= T statement may not explicitly assign a value to each and every column in t= he table, all the columns end up getting some value in them through an INSE= RT statement. The code in InsertResultSet.initializeAIcache method relies o= n availability of all the columns type information. But in case of Update, = resultDescription does not include all the columns in the table. It only ha= s the columns being touched by the Update statement(the rest of the columns= in the table will retain their original values), and for each of those tou= ched columns, it has a duplicate entry in resultDescription in order to hav= e before and after values for the changed column values. This difference in= array content of resultDescription requires us to have separate implementa= tion of initializeAIcache method for insert and update. > MERGE code needs changes since now UPDATE statement can change the identi= ty column value using DEFAULT keyword. > -------------------------------------------------------------------------= -------------------------------------- > > Key: DERBY-6743 > URL: https://issues.apache.org/jira/browse/DERBY-6743 > Project: Derby > Issue Type: Improvement > Components: SQL > Affects Versions: 10.12.0.0 > Reporter: Mamta A. Satoor > > DERBY-6414(Incorrect handling when using an UPDATE to SET an identity col= umn to DEFAULT) has been fixed in Derby 10.12. This will require changes in= MERGE code in order for UPDATE of identity column to work in the MERGE sql= . -- This message was sent by Atlassian JIRA (v6.3.4#6332)