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

Rick Hillegas updated DERBY-3341:
---------------------------------

    Attachment: derby-3341-01-coerce.diff

Attaching derby-3341-01-coerce.diff. This coerces values as they pass from the 
Java domain into the SQL domain. The regression tests run cleanly for me except 
for timeouts in the stress multi tests and a diff in TransactionTable--those 
errors don't seem related to this work. The fix gives me correct results for 
the hand-rolled test cases I tried but I would like to add some more systematic 
cases to the regression tests.

Touches the following files:

M      java/engine/org/apache/derby/impl/sql/compile/FromVTI.java

For Derby-style Table Functions, the function's return type is generated into 
the call which instantiates a VTIResultSet.

M      
java/engine/org/apache/derby/impl/sql/execute/GenericResultSetFactory.java
M      java/engine/org/apache/derby/iapi/sql/execute/ResultSetFactory.java

The extra argument is added to the signatures of the method which instantiates 
a VTIResultSet.

M      java/engine/org/apache/derby/impl/sql/execute/VTIResultSet.java

For Derby-style Table Functions, the return type is unwrapped, the type 
descriptors for the returned columns are extracted, and the values coming out 
of the user-coded ResultSet are coerced according to those column types. The 
coercion logic follows the rules described in CastNode.genDataValueConversion().

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

Modified this test because short string values are now being padded with 
trailing blanks when they are coerced into long CHAR values.

> TABLE FUNCTION returning CHAR values does not return a correct value if the 
> Java ResultSet class returns a value less than the length of the defined CHAR.
> ----------------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: DERBY-3341
>                 URL: https://issues.apache.org/jira/browse/DERBY-3341
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>            Reporter: Daniel John Debrunner
>             Fix For: 10.4.0.0
>
>         Attachments: derby-3341-01-coerce.diff, derby_3341_test.txt
>
>
> Defining a column in the returned type as CHAR(10) requires that the returned 
> value be of length 10 characters.
> Defining a table function with a return type of:
>    returns TABLE  column0 char( 10 ), column1 char( 10 ))
> seems to just return whatever the Java ResultSet implementation handed it.
> My guess this is true for all variable length types, no casting of the value 
> occurs when it is returned to the SQL domain.
> Java single value functions and procedure out parameters do perform any 
> required casting to ensure the value is of the declared type.

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

Reply via email to