Hi,

Yes, it looks like a bug, a possible patch is (excluding the test case):

--- a/h2/src/main/org/h2/expression/Function.java
+++ b/h2/src/main/org/h2/expression/Function.java
@@ -965,6 +965,7 @@ public class Function extends Expression implements
FunctionCall {
             if (v0 == ValueNull.INSTANCE) {
                 result = getNullOrValue(session, args, values, 1);
             }
+            result = convertResult(result);
             break;
         }
         case CASEWHEN: {
@@ -1129,6 +1130,10 @@ public class Function extends Expression implements
FunctionCall {
         return result;
     }

+    private Value convertResult(Value v) {
+        return v.convertTo(dataType);
+    }
+
     private static boolean cancelStatement(Session session, int
targetSessionId) {
         session.getUser().checkAdmin();
         Session[] sessions = session.getDatabase().getSessions(false);

I will test this patch and commit it if I don't find problems.

Regards,
Thomas

-- 
You received this message because you are subscribed to the Google Groups "H2 
Database" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/h2-database.
For more options, visit https://groups.google.com/d/optout.

Reply via email to