db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Knut Anders Hatlen (JIRA)" <j...@apache.org>
Subject [jira] Updated: (DERBY-4658) Allow explicit casts of string values to BOOLEAN
Date Fri, 18 Jun 2010 08:45:23 GMT

     [ https://issues.apache.org/jira/browse/DERBY-4658?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Knut Anders Hatlen updated DERBY-4658:
--------------------------------------

    Attachment: nullability.diff

I followed the calls from ConstantNode.init(), and it does seem like the data type of the
constant is initialized with the nullability specified in the second argument. I tried to
apply the first patch and remove the call to setNullability(), and then BooleanValuesTest
failed in test_08_stringCasts, but only in client/server mode. When I applied the second patch,
BooleanValuesTest ran cleanly also with setNullability() removed.

The attached patch nullability.diff adds a new test case that tests the nullability explicitly.
It fails (also in embedded mode) when setNullability() is removed from the first patch, and
runs cleanly when setNullability() is removed from the second patch. The patch also removes
the call to setNullability() from CastNode.

> Allow explicit casts of string values to BOOLEAN
> ------------------------------------------------
>
>                 Key: DERBY-4658
>                 URL: https://issues.apache.org/jira/browse/DERBY-4658
>             Project: Derby
>          Issue Type: Improvement
>          Components: SQL
>            Reporter: Rick Hillegas
>            Assignee: Rick Hillegas
>         Attachments: derby-4658-01-aa-booleanCasts.diff, derby-4658-01-ab-booleanCasts.diff,
nullability.diff
>
>
> The SQL Standard allows strings to be explicitly cast to BOOLEAN values. Strings are
the only type (other than BOOLEAN itself) which can be cast to BOOLEAN. As part of our expanding
support for the BOOLEAN datatype, we should allow these casts.
> Casting string types to boolean is defined by part 2, section 6.12 (<cast specification>),
general rule 20:
> a) Trim whitespace off the string
> b) Then apply the rules in section 5.3 (<literal>). This means that the trimmed
string must be 'TRUE', 'FALSE', or 'UNKNOWN', regardless of case.
> c) Otherwise, raise an exception.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message