db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rick Hillegas <Richard.Hille...@Sun.COM>
Subject Re: [jira] Commented: (DERBY-695) Re-enable the TINYINT datatype
Date Fri, 11 Nov 2005 23:17:23 GMT
Hi Dan,

If I said somewhere that Postgres supports TINYINT, then that was a big, 
old lie. Perhaps my brain short-circuited and I meant the other open 
source database I care about: MySQL. As you note, MySQL supports a 
TINYINT datatype, intended to fit in a byte. I'm looking at a copy of 
the MySQL Reference Manual version 5.0,3-alpha. Section 11.1.1 of that 
manual gives both signed and unsigned ranges of the integer types. 
Section 11.2 says that when declaring these types, you can specify an 
extra UNSIGNED keyword to pick the unsigned range.

Sybase and Microsoft SQL Server, as you note, support the unsigned range 
for TINYINT. It's interesting that all of the other integer types are 
signed quantities. See 
http://gsbwww.uchicago.edu/computing/research/SASManual/accdb/z0439559.htm 
and  
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/tsqlref/ts_ia-iz_3ss4.asp.

So as you say, among database vendors TINYINT's range is not 
standardized. This underscores Lance's point about the JDBC verbiage.

Cheers,
-Rick

Daniel John Debrunner wrote:

>Rick Hillegas wrote:
>
>  
>
>>>I see this in section 8.3.4
>>>
>>>"The JDBC type TINYINT represents an 8-bit integer value between 0 and
>>>255 that may be signed or unsigned."
>>> 
>>>
>>>      
>>>
>>Hi Dan,
>>
>>I don't mean to pile up on you after your jet lag. Welcome back!
>>    
>>
>
>I wasn't back, it's that three day in jet-lag, but thanks anyway!
>I'm back now though. :-)
>
>  
>
>>Yeah, that's the same sentence I saw. It's a bit oddly worded. The
>>"8-bit integer value" makes it sound like a byte. But "value between 0
>>and 255 that may be signed or unsigned" could  mean a "value between
>>-256 and 255", that is, a 9-bit quantity. I'm putting my faith in the
>>8-bit part.
>>    
>>
>
>So it seems there would be two choices:
>
>-128 to 127 :
>
>+ matches JDBC 3.0 mapping to a byte (tables B.1/B.2)
>- does not match SQL Server, Sybase
>
>0 to 255 :
>
>+ matches SQL Server, Sybase
>- does not match JDBC 3.0 mapping to a byte
>
>Hmmmm, that's kind of an awkward place to be in. It seems you want to
>add this non-standard SQL type to match other databases, but by matching
>the other databases you break the JDBC spec. :-)
>
>MySQL seems to claim both ranges, but I didn't look to see how you
>specifiy signed vs. unsigned. Given MySQL's type handling in other areas
>I'm not sure they a a good "reference" implementation.
>
>Rick, you also, I think, said in one e-mail that Postgres supports
>TINYINT, I've only been able to find information that Postgres does not
>support TINYINT, do you have a link?
>
>Dan.
>
>
>
>
>
>
>  
>


Mime
View raw message