[
https://issues.apache.org/jira/browse/DERBY-3350?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12562197#action_12562197
]
Daniel John Debrunner commented on DERBY-3350:
----------------------------------------------
One issue is the nullability of various columns returned from
DatabaseMetaData.getXXX() calls.
E.g. getTables() column 1 TABLE_CAT is currently nullable for Derby's meta
data, and this is tested in DatabaseMetaDataTest
The JDBC docs say the column '(may be null)' - though I don't think that means
has to be nullable in any implementation.
Derby's expression that produces this column is:
CAST ('' AS VARCHAR(128)) AS TABLE_CAT
which returns the empty string as the catalog for the table, not NULL.
Fixing this bug changes the nullability to not nullable and thus causes
DatabaseMetaDataTest to fail. Seems like changing nullability to not null is
correct here, it seems that Derby returns '' if a table does not have a
catalog, and to preserve backwards compatibility that would continue to be the
case, even if Derby supported catalogs.
> SQL CAST always marks its type as nullable even if the expression to be cast
> is not nullable
> --------------------------------------------------------------------------------------------
>
> Key: DERBY-3350
> URL: https://issues.apache.org/jira/browse/DERBY-3350
> Project: Derby
> Issue Type: Bug
> Components: SQL
> Affects Versions: 10.0.2.0, 10.0.2.1, 10.1.1.0, 10.1.2.1, 10.1.3.1,
> 10.2.1.6, 10.2.2.0, 10.3.1.4, 10.3.2.1, 10.4.0.0
> Reporter: Daniel John Debrunner
> Assignee: Daniel John Debrunner
> Priority: Minor
>
> Can be exposed as a column's type in a ResultSet being nullable when in
> reality it can never be null.
> Can impact performance as the SQL compiler can general optimal paths with
> correct nullability, e.g. a non-null INTEGER expression does not need
> normalization if being stored in a non-null INTEGER column, routine calling
> can be optimized for a RETURNS NULL ON NULL INPUT function if the inputs are
> never null.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.