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 85673947E for ; Fri, 9 Dec 2011 00:30:03 +0000 (UTC) Received: (qmail 63070 invoked by uid 500); 9 Dec 2011 00:30:03 -0000 Delivered-To: apmail-db-derby-dev-archive@db.apache.org Received: (qmail 63046 invoked by uid 500); 9 Dec 2011 00:30:03 -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 63039 invoked by uid 99); 9 Dec 2011 00:30:03 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 09 Dec 2011 00:30:03 +0000 X-ASF-Spam-Status: No, hits=-2001.2 required=5.0 tests=ALL_TRUSTED,RP_MATCHES_RCVD X-Spam-Check-By: apache.org Received: from [140.211.11.116] (HELO hel.zones.apache.org) (140.211.11.116) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 09 Dec 2011 00:30:00 +0000 Received: from hel.zones.apache.org (hel.zones.apache.org [140.211.11.116]) by hel.zones.apache.org (Postfix) with ESMTP id 08ED4108BDA for ; Fri, 9 Dec 2011 00:29:40 +0000 (UTC) Date: Fri, 9 Dec 2011 00:29:40 +0000 (UTC) From: "Dag H. Wanvik (Commented) (JIRA)" To: derby-dev@db.apache.org Message-ID: <1165346298.55720.1323390580037.JavaMail.tomcat@hel.zones.apache.org> In-Reply-To: <1360687411.53658.1323359140616.JavaMail.tomcat@hel.zones.apache.org> Subject: [jira] [Commented] (DERBY-5525) Precision for UPPER function is wrong if the returned value is longer than the literal argument MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/DERBY-5525?page=3Dcom.atlassian= .jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=3D1316= 5708#comment-13165708 ]=20 Dag H. Wanvik commented on DERBY-5525: -------------------------------------- What is the meaning of "precision" for character strings in the result set?= The Javadoc says: "For character data, this is the length in characters." = But does this mean the actual column's length or the maximum length of the = column type? If we have a VARCHAR(n), I think "n" just as reasonable as LEN= GTH() here... but I am not sure. If it were "n", I guess this issue wo= uld go away.. In any case, solving this just for the literal case isn't eno= ugh, I think. We need to handle the general case.=20 What should happen if an UPPER(col) leads to column type overflow? The SQL = standard says "warning: truncation", cf. section 6.29 , GR 6) g) ii). =20 > Precision for UPPER function is wrong if the returned value is longer tha= n the literal argument > -------------------------------------------------------------------------= ---------------------- > > Key: DERBY-5525 > URL: https://issues.apache.org/jira/browse/DERBY-5525 > Project: Derby > Issue Type: Bug > Components: SQL > Affects Versions: 10.8.2.2 > Reporter: Knut Anders Hatlen > > Seen in ij in a database with territory based collation and German locale= : > =3D=3Dvv=3D COPIED FROM IJ CONSOLE =3Dvv=3D=3D > ij> VALUES UCASE('Stra=C3=9Fenbahn'); > 1 > ----------- > STRASSENBA& > 1 Zeile ausgew=C3=A4hlt > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > And with JDBC calls: > Connection c =3D DriverManager.getConnection( > "jdbc:derby:memory:db;create=3Dtrue;territory=3Dde_DE;" + > "collation=3DTERRITORY_BASED"); > Statement s =3D c.createStatement(); > ResultSet rs =3D s.executeQuery("values upper('Stra=C3=9Fe')"); > System.out.println(rs.getMetaData().getPrecision(1)); > rs.next(); > System.out.println(rs.getString(1)); > This prints > 6 > STRASSE > The precision is wrong, since the returned value is 7 characters long. -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrato= rs: https://issues.apache.org/jira/secure/ContactAdministrators!default.jsp= a For more information on JIRA, see: http://www.atlassian.com/software/jira