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 4C882ECCC for ; Fri, 7 Dec 2012 13:23:22 +0000 (UTC) Received: (qmail 33583 invoked by uid 500); 7 Dec 2012 13:23:22 -0000 Delivered-To: apmail-db-derby-dev-archive@db.apache.org Received: (qmail 33550 invoked by uid 500); 7 Dec 2012 13:23:21 -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 33536 invoked by uid 99); 7 Dec 2012 13:23:21 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 07 Dec 2012 13:23:21 +0000 Date: Fri, 7 Dec 2012 13:23:20 +0000 (UTC) From: "Dag H. Wanvik (JIRA)" To: derby-dev@db.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Comment Edited] (DERBY-6008) Allow ORDER BY and FETCH/OFFSET in set operands 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-6008?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13526374#comment-13526374 ] Dag H. Wanvik edited comment on DERBY-6008 at 12/7/12 1:22 PM: --------------------------------------------------------------- Thanks, Knut. I agree the intersect looks wrong indeed. As for the anomaly in values 1 order by 1+2, I guess this is because the logic to analyze the order by in this case resides in RowResultSetNode, not in UnionNode/SetOperatorNode as in the multi-valued case. I'd guess an omission since it's a corner case. And yes, I could remove the special case for removeOrderByColumns, probably, and just add a comment to remind the reader of the fact. I added it first because I thought I had an error requiring it, but that turned to be something else, but I kept it mostly as a documentary thing. was (Author: dagw): Thanks, Knut. I agree the intersect looks wrong indeed. As for the anomaly in values 1 order by 1+2, I guess this is because the logic to analyze the order by in this case resides in RowResultSetNode, not in UnionNode/SetOperatorNode as in the multi-valued case. I'd guess an omission since it's a corner case. > Allow ORDER BY and FETCH/OFFSET in set operands > ----------------------------------------------- > > Key: DERBY-6008 > URL: https://issues.apache.org/jira/browse/DERBY-6008 > Project: Derby > Issue Type: Improvement > Components: SQL > Reporter: Dag H. Wanvik > Assignee: Dag H. Wanvik > Attachments: derby-6008-a.diff, derby-6008-a.stat, derby-6008-b.diff, derby-6008-b.stat, derby-6008-c.diff, derby-6008-c.stat > > > Currently, Derby doesn't allow ORDER BY nested in a set operand, e.g. in the following construct: > (select i from t1 order by j offset 1 row) union > (select i from t2 order by j desc offset 2 rows) > This is allowed by the standard, as far as I can understand, cf. this quote from section 7.12 in SQL 2011: > ::= > > | UNION [ ALL | DISTINCT ] > [ ] > | EXCEPT [ ALL | DISTINCT ] > [ ] > ::= > > | INTERSECT [ ALL | DISTINCT ] > [ ] > ::= > > | > [ ] [ ] [ ] > I.e. the left paren chooses the second alternative in the production for . -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators For more information on JIRA, see: http://www.atlassian.com/software/jira