Mark Rotteveel
unread,Jun 8, 2025, 7:43:41 AMJun 8Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to firebir...@googlegroups.com
Working on some improvements to the Firebird support in Hibernate, I
noticed an inconsistency in type inference of parameters:
For example, the following doesn't infer types:
select * from rdb$database where (? + 1) > ?;
select * from rdb$database where (? + 1) > (? * 1);
select * from rdb$database where (? + 1) > (? / 1);
select * from rdb$database where (? / 1) > (? * 1);
select * from rdb$database where (? * 1) > (? / 1);
Resulting in
-Data type unknown
or
-expression evaluation not supported
-Invalid data type for multiplication in dialect 3
or
-expression evaluation not supported
-Invalid data type for division in dialect 3
The following do work:
select * from rdb$database where (? + 1) > (? + 1); -- both BIGINT
select * from rdb$database where (? + 1) > (? - 1); -- both BIGINT
select * from rdb$database where (? * 1) > (? - 1); -- BIGINT, INT128
select * from rdb$database where (? / 1) > (? + 1); -- BIGINT, INT128
Why can't Firebird infer the datatypes in the first five cases? I would
argue that if (? + 1) > (? + 1) infers to BIGINT, then it can also infer
the second parameter in (? + 1) > ? to BIGINT, similarly if (? * 1) > (?
- 1) works, then so should (? - 1) / (? * 1) (and same for /).
Should I report this as a bug?
Mark
--
Mark Rotteveel