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

Andy Gumbrecht commented on DERBY-6223:
---------------------------------------

In short (excuse the pun) yes.

The issue is not what Derby can do with boolean now, it is what it couldn't do 
when boolean was not supported. The solution was simply to create smallint 
columns and 'treat' them like boolean. The Hibernate Derby dialect explicitly 
used smallint for a very long time.

A lot of tools check/ed for the presence of a 'table' for their actions (eg. 
does my table exist, yes...then move on), as was the case with Liquibase. It 
failed to check for the boolean/smallint issue in it's own table, and presumed 
that the table had boolean columns.

Now the 'standard' came along much later in Derby and forced itself upon 
databases where the 'standard' was not yet implemented - So I guess the request 
was for something like a transitional flag along the lines of 
'allow.smallint.boolean' =  true - i.e. to allow ps.setBoolean( idx, true) on 
an smallint column

I no longer work at the company where this issue arose, but at the time we had 
literally hundreds of machine generated db's across the globe using smallint. 
It was impossible to use Liquibase to automatically update those databases due 
to the bug mentioned in the description - It all had to be done manually (well 
actually a program was written and distributed). But as it was something that 
customers had to accept it actually took months to get it all rolled out. Had 
such a flag been available to enable the 'violation', in order to update 
smallint columns to boolean columns, then the overall update would have taken 
literally hours if not minutes.

Hope this helps to understand why the issue was raised.

Andy.



> Columns of type 'SMALLINT' cannot hold values of type 'BOOLEAN'
> ---------------------------------------------------------------
>
>                 Key: DERBY-6223
>                 URL: https://issues.apache.org/jira/browse/DERBY-6223
>             Project: Derby
>          Issue Type: Improvement
>          Components: Store
>    Affects Versions: 10.10.1.1
>         Environment: NA
>            Reporter: Andy Gumbrecht
>            Priority: Minor
>             Fix For: 10.10.1.4
>
>
> This minor issue is in relation to a bug at Liquibase 
> (https://liquibase.jira.com/browse/CORE-1088) that occurred due to the 
> addition of the boolean type.
> Prior to the boolean type I am assuming that just about everyone would resort 
> to using smallint.Older databases that may have been machine created based on 
> meta-data are not going to be compatible with future code that will now 
> assume boolean is the norm.
> The improvement I am suggesting is that when smallint columns are fed a 
> boolean value that '1' is accepted as 'true' and anything else 'false'  (0 
> would be a good idea), and likewise for retrieval. Although technically 
> correct, throwing an exception seems to be a touch aggressive here as 
> smallint is more than capable of storing a bit.



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Reply via email to