From 5af53b5d1046a8de50a93836774c344420b011a9 Mon Sep 17 00:00:00 2001 From: Strong Liu Date: Wed, 2 Sep 2009 02:29:36 +0000 Subject: [PATCH] JBPAPP-2715 HHH-4114 : Core - ASTParserLoadingTest fails due to missing 'bit_length' function git-svn-id: https://svn.jboss.org/repos/hibernate/core/trunk@17462 1b8cb986-b30d-0410-93ca-fae66ebed9b2 --- .../test/hql/ASTParserLoadingTest.java | 20 +++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/testsuite/src/test/java/org/hibernate/test/hql/ASTParserLoadingTest.java b/testsuite/src/test/java/org/hibernate/test/hql/ASTParserLoadingTest.java index 258254149c..34c4eb900f 100644 --- a/testsuite/src/test/java/org/hibernate/test/hql/ASTParserLoadingTest.java +++ b/testsuite/src/test/java/org/hibernate/test/hql/ASTParserLoadingTest.java @@ -1941,11 +1941,23 @@ public class ASTParserLoadingTest extends FunctionalTestCase { hql = "from Animal a where mod(16, 4) = 4"; session.createQuery(hql).list(); - - hql = "from Animal a where bit_length(a.bodyWeight) = 24"; + /** + * PostgreSQL >= 8.3.7 typecasts are no longer automatically allowed + * http://www.postgresql.org/docs/current/static/release-8-3.html + */ + if(getDialect() instanceof PostgreSQLDialect){ + hql = "from Animal a where bit_length(str(a.bodyWeight)) = 24"; + }else{ + hql = "from Animal a where bit_length(a.bodyWeight) = 24"; + } + session.createQuery(hql).list(); - - hql = "select bit_length(a.bodyWeight) from Animal a"; + if(getDialect() instanceof PostgreSQLDialect){ + hql = "select bit_length(str(a.bodyWeight)) from Animal a"; + }else{ + hql = "select bit_length(a.bodyWeight) from Animal a"; + } + session.createQuery(hql).list(); /*hql = "select object(a) from Animal a where CURRENT_DATE = :p1 or CURRENT_TIME = :p2 or CURRENT_TIMESTAMP = :p3";