I have created some issues regarding casting in your tracking system, of which I'm pretty sure they're bugs:
http://code.google.com/p/h2database/issues/detail?id=329 http://code.google.com/p/h2database/issues/detail?id=330 http://code.google.com/p/h2database/issues/detail?id=331 http://code.google.com/p/h2database/issues/detail?id=332 In general, I'm curious about the default policy in H2 as far as casting is concerned. I'm asking this before I start entering more bugs :-) By policy I mean a policy regarding constructs like -------------------------------------------------------------- -- which one is better/safer? all bind variables are ints... select ? from dual select cast(? as int) from dual select ? + ? from dual select cast(? as int) + cast(? as int) from dual select ? || ? from dual select cast(? as varchar) + cast(? as varchar) from dual select cast(cast(? as int) as varchar) + cast(cast(? as int) as varchar) from dual -------------------------------------------------------------- So, when should I always cast, and when can I expect H2 to derive a type from a) the query syntax b) the bind variable type c) the query outcome For reference, this is my experience as far as bind variable casting is concerned with various RDBMS. Note the major RDBMS are all very flexible as far as casting and type-safety is concerned. I guess that's a lot of work, to be so flexible... Officially type-safe (or in other words almost absent support for deriving types). With these RDBMS I must cast, or I'm lost: - DB2 - Derby Deriving quite a lot of types, but with the odd bug in weird query syntax constructs (the way I love them for my tests): - H2 - HSQLDB Deriving almost all types with very few "bugs": - Ingres - Sybase Very flexible, no need for casting: - MySQL - Oracle - Postgres - SQL Server Officially type-unsafe (all types are equal, i.e. you can put any string in a number column, for whatever reason anyone wants to do that): - SQLite -- You received this message because you are subscribed to the Google Groups "H2 Database" group. To post to this group, send email to h2-database@googlegroups.com. To unsubscribe from this group, send email to h2-database+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/h2-database?hl=en.