Return-Path: Delivered-To: apmail-db-derby-dev-archive@www.apache.org Received: (qmail 1939 invoked from network); 10 Feb 2010 14:24:52 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 10 Feb 2010 14:24:52 -0000 Received: (qmail 11063 invoked by uid 500); 10 Feb 2010 14:24:51 -0000 Delivered-To: apmail-db-derby-dev-archive@db.apache.org Received: (qmail 11035 invoked by uid 500); 10 Feb 2010 14:24:51 -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 11027 invoked by uid 99); 10 Feb 2010 14:24:51 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 10 Feb 2010 14:24:51 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.140] (HELO brutus.apache.org) (140.211.11.140) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 10 Feb 2010 14:24:49 +0000 Received: from brutus.apache.org (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 0BD6029A0016 for ; Wed, 10 Feb 2010 06:24:28 -0800 (PST) Message-ID: <1336867196.179661265811868046.JavaMail.jira@brutus.apache.org> Date: Wed, 10 Feb 2010 14:24:28 +0000 (UTC) From: "Rick Hillegas (JIRA)" To: derby-dev@db.apache.org Subject: [jira] Updated: (DERBY-4513) Forbid NEXT VALUE FOR clause in certain contexts In-Reply-To: <348044516.187021263321354557.JavaMail.jira@brutus.apache.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/DERBY-4513?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Rick Hillegas updated DERBY-4513: --------------------------------- Attachment: derby-4513_01-ab-illegalContexts.diff Thanks for looking at the patch, Knut. I don't know what's going on. I did notice merge errors when I resynced this patch client with the trunk. I've brought the patch up-to-date with the head of the trunk and am attaching a merged revision: derby-4513_01-ab-illegalContexts.diff Here's what I see with this patch when I run your experiment: ij version 10.6 ij> connect 'jdbc:derby:memory:dummy;create=true'; ij> create sequence s; 0 rows inserted/updated/deleted ij> select * from sysibm.sysdummy1 where (next value for s) < 4; ERROR 42XAH: A NEXT VALUE FOR expression may not appear in many contexts, including WHERE, ON, HAVING, ORDER BY, DISTINCT, CASE, GENERATION, and AGGREGATE clauses as well as WINDOW functions and CHECK constraints. Let me know if this still doesn't fix the problem. Thanks. > Forbid NEXT VALUE FOR clause in certain contexts > ------------------------------------------------ > > Key: DERBY-4513 > URL: https://issues.apache.org/jira/browse/DERBY-4513 > Project: Derby > Issue Type: Bug > Components: SQL > Affects Versions: 10.6.0.0 > Reporter: Rick Hillegas > Assignee: Rick Hillegas > Attachments: derby-4513_01-aa-illegalContexts.diff, derby-4513_01-ab-illegalContexts.diff > > > This is part of the work needed to implement ANSI/ISO sequences. The functional spec attached to DERBY-712 lists various situations in which the NEXT VALUE FOR clause is illegal. These include: > * CASE expression > * WHERE clause > * ORDER BY clause > * AGGREGATE expression > * WINDOW function > * DISTINCT select list > In addition, I propose that we make it illegal for a statement to have more than one NEXT VALUE FOR clause on the same sequence generator. This is a tighter restriction than the ANSI/ISO standard calls for. The standard requires that if two columns in a row are populated by NEXT VALUE FOR clauses on the same sequence, then the values should be the same. I don't feel confident that I could track down all of the cases which could give rise to this situation--so I propose to limit the number of NEXT VALUE FOR clauses on a given sequence generator to just 1. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.