ERROR SqlExceptionHelper: Unknown data type: "unsigned"

160 views
Skip to first unread message

sravan dyapa

unread,
Oct 13, 2022, 11:16:56 AM10/13/22
to H2 Database
Hello,

getting this error while running the query in my tests.

SqlExceptionHelper: SQL Error: 50004, SQLState: HY004
2022-10-13 18:56:11,049 ERROR SqlExceptionHelper: Unknown data type: "unsigned"; SQL statement:
select * from user where name = ? and program regexp(?) order by CAST(sequence as UNSIGNED) asc [50004-200]

may I know how to make this compatible?? 


Evgenij Ryazanov

unread,
Oct 14, 2022, 12:00:26 AM10/14/22
to H2 Database
Hello.

CAST in MySQL and its forks is not compliant with cast specification from the SQL Standard and is not compatible with other database systems. H2 cannot emulate this deviation.

You can replace it with something like
case when sequence >= 0 then sequence else sequence + 18446744073709551616 end
It should work in almost all database systems, including MySQL and H2.
Reply all
Reply to author
Forward
0 new messages