db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ephemeris Lappis (JIRA)" <j...@apache.org>
Subject [jira] Commented: (DERBY-2445) Function VARCHAR truncates the results at 15 characters
Date Mon, 12 Mar 2007 08:24:09 GMT

    [ https://issues.apache.org/jira/browse/DERBY-2445?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12480004
] 

Ephemeris Lappis commented on DERBY-2445:
-----------------------------------------

I have the problem with versions 10.1.2.1 and 10.2.2.0... (I was working with the first, and
i've tried the latter to verify if the problem still exists with a newer version).

Example :

CREATE TABLE PERSON (
	PERSON_IDENTIFIER VARCHAR(24) PRIMARY KEY NOT NULL,
	FIRST_NAME VARCHAR(32),
	LAST_NAME VARCHAR(32),
	SEX INTEGER
);

INSERT INTO PERSON VALUES ('X', 'FN', '123456789-123456789-', 0);

UPDATE PERSON SET LAST_NAME = VARCHAR(PERSON.LAST_NAME);

After the last statement, the resulting string value is '123456789-12345' instead of the expected
original value. After several tests, it seems the result is always truncated at 15 characters,
if longer...

As i mentioned before, i've detected the problem with Top-Link that adds a VARCHAR function
around the string concatenation when it translates some JPA statement like :

UPDATE Person p SET p.lastName = CONCAT(p.lastName, '-XYZ')

into a SQL statement :

UPDATE PERSON SET LAST_NAME = VARCHAR(PERSON.LAST_NAME || '-XYZ');

Hibernate, for example, doesn't add the VARCHAR to translate the same statement, and, obviously
, it works as expected... I don't know if Top-Link has good reasons to use the VARCHAR function,
but as I can't avoid it !...

Is it enough ?

Thanks.

> Function VARCHAR truncates the results at 15 characters
> -------------------------------------------------------
>
>                 Key: DERBY-2445
>                 URL: https://issues.apache.org/jira/browse/DERBY-2445
>             Project: Derby
>          Issue Type: Bug
>    Affects Versions: 10.1.2.1, 10.2.2.0
>         Environment: Windows XP.
>            Reporter: Ephemeris Lappis
>
> The VARCHAR function truncates its argument, or result, at 15 characters.
> For example, with the statement :
> UPDATE PERSON SET LAST_NAME = VARCHAR(PERSON.LAST_NAME);
> An original column value with '123456789-123456789-' is truncated and the result is '123456789-12345'.
> NB : Such a statement seems a bit stupid, but i've detected the problem using Top-Link
that uses the VARCHAR function to translate the JPA CONCAT function. And as I can't change
what Top Link does...
> Thanks for your help.

-- 
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