Return-Path: Delivered-To: apmail-db-derby-dev-archive@www.apache.org Received: (qmail 5799 invoked from network); 27 Jun 2005 21:38:16 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 27 Jun 2005 21:38:16 -0000 Received: (qmail 69657 invoked by uid 500); 27 Jun 2005 21:34:47 -0000 Delivered-To: apmail-db-derby-dev-archive@db.apache.org Received: (qmail 69108 invoked by uid 500); 27 Jun 2005 21:34: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 64256 invoked by uid 99); 27 Jun 2005 21:33:01 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 27 Jun 2005 14:33:01 -0700 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received-SPF: neutral (asf.osuosl.org: local policy) Received: from [32.97.182.146] (HELO e6.ny.us.ibm.com) (32.97.182.146) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 27 Jun 2005 14:33:01 -0700 Received: from d01relay04.pok.ibm.com (d01relay04.pok.ibm.com [9.56.227.236]) by e6.ny.us.ibm.com (8.12.11/8.12.11) with ESMTP id j5RLWuJM004510 for ; Mon, 27 Jun 2005 17:32:56 -0400 Received: from d01av04.pok.ibm.com (d01av04.pok.ibm.com [9.56.224.64]) by d01relay04.pok.ibm.com (8.12.10/NCO/VERS6.7) with ESMTP id j5RLWunj247076 for ; Mon, 27 Jun 2005 17:32:56 -0400 Received: from d01av04.pok.ibm.com (loopback [127.0.0.1]) by d01av04.pok.ibm.com (8.12.11/8.13.3) with ESMTP id j5RLWu4C027530 for ; Mon, 27 Jun 2005 17:32:56 -0400 Received: from [127.0.0.1] (Abrown.svl.ibm.com [9.30.40.194]) by d01av04.pok.ibm.com (8.12.11/8.12.11) with ESMTP id j5RLWsgn027381 for ; Mon, 27 Jun 2005 17:32:56 -0400 Message-ID: <42C070B4.3050408@sbcglobal.net> Date: Mon, 27 Jun 2005 14:33:40 -0700 From: Army User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.7.1) Gecko/20040707 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Derby Development Subject: Documentation vs. Actual behavior with UNION/INTERSECT/EXCEPT Content-Type: text/plain; charset=us-ascii; format=flowed 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 I noticed the following two differences between what the documentation (Reference Manual) says about UNION/INTERSECT/EXCEPT queries and what the actual Derby behavior is. I'm not sure if the documentation is wrong or if the behavior is wrong--anyone out there know? 1) -- p. 63: "Naming columns" First paragraph in this section includes the following: When the SelectExpression appears in a UNION, INTERSECT, or EXCEPT operator, the names from the first SelectExpression are taken as the names for the columns in the result of the operation. But this doesn't appear to be true. Ex: ij> select a from t1 union select b from t2; 1 // This "1" should be "A", according to doc. ----------- 1 2 If this behavior is intentional, then an ORDER BY clause on a UNION/INTERSECT/EXCEPT result set can only reference the result columns by position (ex. would have to use "order by 1" in the above query since "order by a" doesn't work (because the name of the result column isn't "a")). Note that if both SelectExpressions have the same column name, then things work differently: ij> select a from t1 union select b as a from t2; I // Now it's "A" instead of "1". ----------- 1 2 So what needs to be corrected here? The documentation or the code? 2) -- p. 133: "Where dynamic parameters are allowed" Number 16 says "a dynamic parameter is allowed to represent a column if it appears in a UNION, INTERSECT, or EXCEPT expression." But the two examples that it gives both fail: ij> SELECT ? FROM t UNION SELECT 1 FROM t; ERROR 42X34: There is a ? parameter in the select list. This is not allowed. ij> VALUES 1 UNION VALUES ?; ERROR 42X34: There is a ? parameter in the select list. This is not allowed. I also tried preparing these statements using JDBC, but they failed there with the same error. I assume this is just a documentation error, but if anyone knows differently, please speak up... Thanks, Army