Return-Path: Delivered-To: apmail-db-derby-dev-archive@www.apache.org Received: (qmail 82273 invoked from network); 15 May 2005 02:24:22 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 15 May 2005 02:24:22 -0000 Received: (qmail 33107 invoked by uid 500); 15 May 2005 02:28:40 -0000 Delivered-To: apmail-db-derby-dev-archive@db.apache.org Received: (qmail 33021 invoked by uid 500); 15 May 2005 02:28:39 -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: "Derby Development" Delivered-To: mailing list derby-dev@db.apache.org Received: (qmail 32831 invoked by uid 99); 15 May 2005 02:28:38 -0000 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received: from ajax-1.apache.org (HELO ajax.apache.org) (192.87.106.226) by apache.org (qpsmtpd/0.28) with ESMTP; Sat, 14 May 2005 19:28:37 -0700 Received: from ajax.apache.org (ajax.apache.org [127.0.0.1]) by ajax.apache.org (Postfix) with ESMTP id F41532E1 for ; Sun, 15 May 2005 04:24:04 +0200 (CEST) Message-ID: <31337976.1116123844998.JavaMail.jira@ajax.apache.org> Date: Sun, 15 May 2005 04:24:04 +0200 (CEST) From: "Mamta A. Satoor (JIRA)" To: derby-dev@db.apache.org Subject: [jira] Commented: (DERBY-287) Return value of IDENTITY_VAL_LOCAL for different connections is not related. In-Reply-To: <274089136.1116077646943.JavaMail.jira@ajax.apache.org> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N [ http://issues.apache.org/jira/browse/DERBY-287?page=comments#action_65418 ] Mamta A. Satoor commented on DERBY-287: --------------------------------------- While we are working on fixing IDENTITY_VAL_LOCAL documentation, let's add the relevant information for triggers as well. Here is the info about it but can someone please re-word this properly for documentation? If a table with an identity column has an insert trigger defined which inserts into another table with identity column, then IDENTITY_VAL_LOCAL() function will return the generated value for the statement table and not for the table modified by the trigger. eg $ java -Dij.exceptionTrace=true org.apache.derby.tools.ij ij version 10.1 ij> connect 'jdbc:derby:c:/dellater/db1'; ij> create table t1 (c11 int generated always as identity (start with 101, increment by 3), c12 int); 0 rows inserted/updated/deleted ij> create table t2 (c21 int generated always as identity (start with 201, increment by 5), c22 int); 0 rows inserted/updated/deleted ij> create trigger t1tr1 after insert on t1 for each row mode db2sql insert into t2 (c22) values (1); 0 rows inserted/updated/deleted ij> values IDENTITY_VAL_LOCAL(); 1 ------------------------------- NULL 1 row selected ij> insert into t1 (c12) values (1); 1 row inserted/updated/deleted ij> values IDENTITY_VAL_LOCAL(); 1 ------------------------------- 101 1 row selected ij> select * from t1; C11 |C12 ----------------------- 101 |1 1 row selected ij> select * from t2; C21 |C22 ----------------------- 201 |1 1 row selected ij> > Return value of IDENTITY_VAL_LOCAL for different connections is not related. > ---------------------------------------------------------------------------- > > Key: DERBY-287 > URL: http://issues.apache.org/jira/browse/DERBY-287 > Project: Derby > Type: Bug > Reporter: Mamta A. Satoor > > The current IDENTITY_VAL_LOCAL documentation (http://incubator.apache.org/derby/docs/ref/ref-single.html#rrefidentityvallocal) is unclear if the IDENTITY_VAL_LOCAL function returns the most recently assigned value for an identity column, for a connection/transaction/database and it needs to be fixed to say that it is for a connection. > The first line in the current doc is "The IDENTITY_VAL_LOCAL function is a non-deterministic function that returns the most recently assigned value for an identity column, where the assignment occurred as a result of a single row INSERT statement using a VALUES clause. " It should read as "The IDENTITY_VAL_LOCAL function is a non-deterministic function that, for a connection, returns the most recently assigned value for an identity column, where the assignment occurred as a result of a single row INSERT statement using a VALUES clause." > There is another line on the same page which reads "The value returned by the IDENTITY_VAL_LOCAL function is the value assigned to the identity column of the table identified in the most recent single row INSERT statement." This needs to be slightly modified to say "The value returned by the IDENTITY_VAL_LOCAL function, for a connection, is the value assigned to the identity column of the table identified in the most recent single row INSERT statement." -- 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