You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-dev@db.apache.org by "Rick Hillegas (JIRA)" <ji...@apache.org> on 2009/12/12 21:43:18 UTC

[jira] Updated: (DERBY-4469) Fix the CASTing behavior of UDTs

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

Rick Hillegas updated DERBY-4469:
---------------------------------

    Attachment: derby-4469-01-aa-castNullsAndUntypedParameters.diff

Attaching derby-4469-01-aa-castNullsAndUntypedParameters.diff. This patch makes it possible to cast nulls and untyped ? parameters as UDTs. More tests will need to be written to verify that casting from builtin types to UDTs and vice-versa does not work. Some additional logic will need to be written to handle the case when a UDT is bound to one of the Java types which correspond to Derby's SQL types (e.g., String, Integer, etc.). Tests passed cleanly for me. Committed at subversion revision 889975.

Touches the following files:

M      java/engine/org/apache/derby/impl/sql/compile/sqlgrammar.jj
M      java/engine/org/apache/derby/impl/sql/compile/CastNode.java

Allow casting to UDTs.

M      java/testing/org/apache/derbyTesting/functionTests/tests/lang/UDTTest.java

Verify that the following now work:

  cast ( null as udtType )
  cast ( ? as udtType )

In addition, change the definition of the UDT dependent views so that they reference UDTs via casts rather than via function calls. This will tease apart the next bit of dependency tracking which must be built: dependencies of routines on UDTs.


M      java/testing/org/apache/derbyTesting/functionTests/master/db2Compatibility.out

The casts to Java types now fail with a different syntax error.


> Fix the CASTing behavior of UDTs
> --------------------------------
>
>                 Key: DERBY-4469
>                 URL: https://issues.apache.org/jira/browse/DERBY-4469
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 10.6.0.0
>            Reporter: Rick Hillegas
>            Assignee: Rick Hillegas
>         Attachments: derby-4469-01-aa-castNullsAndUntypedParameters.diff
>
>
> The actual behavior of UDTs, now under construction, does not conform to the spec. The spec says that you can't CAST to or from UDTs. This is probably too harsh. We should allow the following CAST
>   cast ( null as udtType )
> I also think that we should allow at least the implicit casting of subtypes to supertypes since Java gives us the ability to discover the type graph. See Knut's comment on DERBY-651 on Dec 11, 2009.

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