[ 
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-da-coerceWithTests.diff

Attaching a second rev of a fix: derby-01-da-coerceWithTests.diff. This extends 
the previous patch as follows:

1) Adds tests to verify that the behavior is what we expect for CHAR, VARCHAR, 
BINARY, VARBINARY, LONG VARCHAR, LONG VARBINARY, and DECIMAL.

2) Adds some extra logic to make the LONG VARCHAR and LONG VARBINARY cases 
correct. The current cast-based behavior with scalar functions is not correct 
for LONG VARCHAR (see DERBY-3511) and I suspect it is not correct for LONG 
VARBINARY either (see DERBY-3512).

I am running regression tests now. For the record, my first attempt to fix this 
problem was to insert CASTs into the bound tree. That did not work. We can 
experiment with other solutions later on. As a first increment, I would like to 
make the behavior correct.

> 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-01-da-coerceWithTests.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