db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Dag H. Wanvik (Commented) (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (DERBY-5525) Precision for UPPER function is wrong if the returned value is longer than the literal argument
Date Fri, 09 Dec 2011 15:34:40 GMT

    [ https://issues.apache.org/jira/browse/DERBY-5525?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13166244#comment-13166244

Dag H. Wanvik commented on DERBY-5525:

Yes, my point was exactly that the metadata type is for the resultset. not the column. So,
in order not to get truncation, one would have to write something like:
values cast(upper('Straße') as varchar(7));

This also displays correctly:

ij> values upper('Straße') , '1234567';

So, we should this issue as invalid. Do we generate a truncation warning, though?

> I don't see much value in adding a truncation warning for the case where upper() can
be evaluated at compilation-time:
> select ... where col1 = upper( 'Straße' )

I think we should. The semantics for the case according to the standard should be the same.
Since we *do* generate a result set which shows the truncation, I believe we should generate
the warning as well.

As for lcase and ucase in JDBC, aren't these supposed to map to underlying functions if they
are available? If so, why should they have different semantics? Sounds confusing to me..

> Precision for UPPER function is wrong if the returned value is longer than the literal
> -----------------------------------------------------------------------------------------------
>                 Key: DERBY-5525
>                 URL: https://issues.apache.org/jira/browse/DERBY-5525
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions:
>            Reporter: Knut Anders Hatlen
> Seen in ij in a database with territory based collation and German locale:
> ij> VALUES UCASE('Straßenbahn');
> 1
> -----------
> 1 Zeile ausgewählt
> ==================================
> And with JDBC calls:
>     Connection c = DriverManager.getConnection(
>             "jdbc:derby:memory:db;create=true;territory=de_DE;" +
>             "collation=TERRITORY_BASED");
>     Statement s = c.createStatement();
>     ResultSet rs = s.executeQuery("values upper('Straße')");
>     System.out.println(rs.getMetaData().getPrecision(1));
>     rs.next();
>     System.out.println(rs.getString(1));
> This prints
> 6
> 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 administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira


View raw message