For functions with integer return types, the range of the integer is ignored.
Created attachment 63 [details] Test case
Created attachment 64 [details] Query file for test case
Fixed on the trunk from rev. 1661.