We were using Firebird 1.5 and we had a UDF called f_strblob which came from the FreeUDFLib.dll. We were using this UDF in the following select SQL statement:

SELECT PI.ORG, PI.ID, OPI.COMMENTS, PI.DESCRIPTION, PI.MIN_DONATION, PI.ORDERABLE, OPI.POPUP
FROM PRODUCT_INFO PI LEFT OUTER JOIN ORG_PRD_INFO OPI ON OPI.ORG = PI.ORG AND OPI.PID = PI.ID JOIN ORGANIZATIONS O ON PI.ORG = O.ORGANIZATION_ABBREVIATION AND O.ACTIVE_YN = 'Y'
UNION SELECT OPI.ORG, OPI.PID ID, OPI.COMMENTS, CAST('Organization Comments' AS VARCHAR(60)), CAST(0.0 AS double precision), 'N', f_strblob('')
FROM ORG_PRD_INFO OPI JOIN ORGANIZATIONS O ON OPI.ORG = O.ORGANIZATION_ABBREVIATION AND O.ACTIVE_YN = 'Y' WHERE OPI.PID = 'NONE'
ORDER BY 1, 2

After upgrading to Firebird 2.0, now that statement gives this error:

fmSQLEditor.Query:
Invalid token.
Dynamic SQL Error.
SQL error code = -104.
Datatypes are not comparable in expression UNION.


As soon as I take out the OPI.POPUP and f_strblob('') from the statement it runs, so the problem is with the fuction. I tried using a different library, but same error. Eventually I got it working by replacing f_strblob('') with null, but I would still like to know what was causing the problem in the first place