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

Knut Anders Hatlen commented on DERBY-1745:
-------------------------------------------

One consequence of this was seen in the first proposed fix for DERBY-5274. When 
using the CHAR function to convert a BIGINT in SYS.SYSCOLUMNS to a CHAR value 
in DatabaseMetaData.getColumns(), a truncation error was raised when running on 
a database upgraded from 10.3.1.4 or later.

For a simple reproduction, create a database with 10.3.1.4 and boot it with 
10.8.1.2. Then execute the following statements:

ij> create table t (x int not null generated always as identity (start with 
12));
0 rows inserted/updated/deleted
ij> select char(autoincrementstart) from sys.syscolumns where columnname='X';
1   
----
ERROR 22001: A truncation error was encountered trying to shrink CHAR '12' to 
length 1.

If the database had been created with 10.4.1.3 or later, the select statement 
would complete successfully.

> System catalog columns of type BIGINT and INT created with incorrect 
> precision of zero.
> ---------------------------------------------------------------------------------------
>
>                 Key: DERBY-1745
>                 URL: https://issues.apache.org/jira/browse/DERBY-1745
>             Project: Derby
>          Issue Type: Task
>          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
>            Reporter: Daniel John Debrunner
>            Priority: Minor
>
> Due to the way system column metadata was handled in the code system columns 
> of these types are always created with precision 0.
> User defined columns of these types will have precision 10 (INT) and 19 
> (BIGINT)
> DERBY-1734 will fix this for 10.3 and hopefully 10.2 by a merge before the 
> release.
> This bug is here to investigate upgrade issues and fix them if required.
> Not known of any incorrect issues due to this, except for incorrect JDBC 
> metadata for such columns.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to