Return-Path: Delivered-To: apmail-db-derby-dev-archive@www.apache.org Received: (qmail 45212 invoked from network); 28 Apr 2008 23:27:46 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 28 Apr 2008 23:27:46 -0000 Received: (qmail 82388 invoked by uid 500); 28 Apr 2008 23:27:47 -0000 Delivered-To: apmail-db-derby-dev-archive@db.apache.org Received: (qmail 82347 invoked by uid 500); 28 Apr 2008 23:27:47 -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 82335 invoked by uid 99); 28 Apr 2008 23:27:47 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 28 Apr 2008 16:27:47 -0700 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; Mon, 28 Apr 2008 23:26:54 +0000 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id A0736234C12A for ; Mon, 28 Apr 2008 16:23:55 -0700 (PDT) Message-ID: <195735953.1209425035655.JavaMail.jira@brutus> Date: Mon, 28 Apr 2008 16:23:55 -0700 (PDT) From: "Kathey Marsden (JIRA)" To: derby-dev@db.apache.org Subject: [jira] Commented: (DERBY-3649) can't call a stored function with an aggregate argument without getting the following error: ERROR 42Y29 In-Reply-To: <1135588304.1209421675621.JavaMail.jira@brutus> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/DERBY-3649?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12592927#action_12592927 ] Kathey Marsden commented on DERBY-3649: --------------------------------------- It seems to only add it to the generated columns if it is an instance of ColumnReference. In GroupByList see ~line 177 if (! matchFound && groupingCol.getColumnExpression() instanceof ColumnReference) { // only add matching columns for column references not // expressions yet. See DERBY-883 for details. I am wondering if VerifyAggregateExpressionsVisitor is even the right place to check if the group by expression is a function. It seems to know only about the select columns. Maybe we should be checking elsewhere entirely. > can't call a stored function with an aggregate argument without getting the following error: ERROR 42Y29 > -------------------------------------------------------------------------------------------------------- > > Key: DERBY-3649 > URL: https://issues.apache.org/jira/browse/DERBY-3649 > Project: Derby > Issue Type: Bug > Components: SQL > Affects Versions: 10.4.1.3 > Environment: ------------------ Java Information ------------------ > Java Version: 1.6.0 > Java Vendor: Sun Microsystems Inc. > Java home: /usr/java/jdk1.6.0/jre > Java classpath: /me/apache_libs/db-derby-10.4.1.3-bin/lib/derby.jar:/me/apache_libs/db-derby-10.4.1.3-bin/lib/derbynet.jar:/me/apache_libs/db-derby-10.4.1.3-bin/lib/derbytools.jar:/me/apache_libs/db-derby-10.4.1.3-bin/lib/derbyclient.jar > OS name: Linux > OS architecture: i386 > OS version: 2.6.23.1 > Java user name: me > Java user home: /me > Java user dir: /me/apache_libs/db-derby-10.4.1.3-bin/bin > java.specification.name: Java Platform API Specification > java.specification.version: 1.6 > --------- Derby Information -------- > JRE - JDBC: Java SE 6 - JDBC 4.0 > [/me/apache_libs/db-derby-10.4.1.3-bin/lib/derby.jar] 10.4.1.3 - (648739) > [/me/apache_libs/db-derby-10.4.1.3-bin/lib/derbytools.jar] 10.4.1.3 - (648739) > [/me/apache_libs/db-derby-10.4.1.3-bin/lib/derbynet.jar] 10.4.1.3 - (648739) > [/me/apache_libs/db-derby-10.4.1.3-bin/lib/derbyclient.jar] 10.4.1.3 - (648739) > ------------------------------------------------------ > ----------------- Locale Information ----------------- > Current Locale : [English/United States [en_US]] > Found support for locale: [cs] > version: 10.4.1.3 - (648739) > Found support for locale: [de_DE] > version: 10.4.1.3 - (648739) > Found support for locale: [es] > version: 10.4.1.3 - (648739) > Found support for locale: [fr] > version: 10.4.1.3 - (648739) > Found support for locale: [hu] > version: 10.4.1.3 - (648739) > Found support for locale: [it] > version: 10.4.1.3 - (648739) > Found support for locale: [ja_JP] > version: 10.4.1.3 - (648739) > Found support for locale: [ko_KR] > version: 10.4.1.3 - (648739) > Found support for locale: [pl] > version: 10.4.1.3 - (648739) > Found support for locale: [pt_BR] > version: 10.4.1.3 - (648739) > Found support for locale: [ru] > version: 10.4.1.3 - (648739) > Found support for locale: [zh_CN] > version: 10.4.1.3 - (648739) > Found support for locale: [zh_TW] > version: 10.4.1.3 - (648739) > ------------------------------------------------------ > Reporter: Sebastian > Assignee: Kathey Marsden > > hi, > i cant execute the following statement with an aggregate (count(*)) argument: > SELECT checkCount(count(*)) FROM SYS.SYSTABLES; > .. without getting this error/stacktrace: > ERROR 42Y29: The SELECT list of a non-grouped query contains at least one invalid expression. When the SELECT list contains at least one aggregate then all entries must be valid aggregate expressions. > java.sql.SQLSyntaxErrorException: The SELECT list of a non-grouped query contains at least one invalid expression. When the SELECT list contains at least one aggregate then all entries must be valid aggregate expressions. > at org.apache.derby.client.am.SQLExceptionFactory40.getSQLException(Unknown Source) > at org.apache.derby.client.am.SqlException.getSQLException(Unknown Source) > at org.apache.derby.client.am.Statement.execute(Unknown Source) > at org.apache.derby.impl.tools.ij.ij.executeImmediate(Unknown Source) > at org.apache.derby.impl.tools.ij.utilMain.doCatch(Unknown Source) > at org.apache.derby.impl.tools.ij.utilMain.runScriptGuts(Unknown Source) > at org.apache.derby.impl.tools.ij.utilMain.go(Unknown Source) > at org.apache.derby.impl.tools.ij.Main.go(Unknown Source) > at org.apache.derby.impl.tools.ij.Main.mainCore(Unknown Source) > at org.apache.derby.impl.tools.ij.Main.main(Unknown Source) > at org.apache.derby.tools.ij.main(Unknown Source) > Caused by: org.apache.derby.client.am.SqlException: The SELECT list of a non-grouped query contains at least one invalid expression. When the SELECT list contains at least one aggregate then all entries must be valid aggregate expressions. > at org.apache.derby.client.am.Statement.completeSqlca(Unknown Source) > at org.apache.derby.client.net.NetStatementReply.parsePrepareError(Unknown Source) > at org.apache.derby.client.net.NetStatementReply.parsePRPSQLSTTreply(Unknown Source) > at org.apache.derby.client.net.NetStatementReply.readPrepareDescribeOutput(Unknown Source) > at org.apache.derby.client.net.StatementReply.readPrepareDescribeOutput(Unknown Source) > at org.apache.derby.client.net.NetStatement.readPrepareDescribeOutput_(Unknown Source) > at org.apache.derby.client.am.Statement.readPrepareDescribeOutput(Unknown Source) > at org.apache.derby.client.am.Statement.flowExecute(Unknown Source) > at org.apache.derby.client.am.Statement.executeX(Unknown Source) > ... 9 more > here the code to create the function in derby: > CREATE FUNCTION checkCount > (count INTEGER) > RETURNS INTEGER > LANGUAGE JAVA PARAMETER STYLE JAVA > NO SQL > EXTERNAL NAME 'ExceptionOnZeroCount.checkCount'; > and here the code of the (quite simple) java method: > public class ExceptionOnZeroCount { > public static int checkCount(int count) > throws SQLException { > if (count == 0) > throw new SQLException("No results found", "38777"); > } > return count; > } > } > hope this will be fixed :) Good night! > mamurdian -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.