Skip to content

Commit 0254751

Browse files
committed
NH-3096 - Ignore tests for SQLiteDialect
It seems that coalesce function in SQLite loses expression type So following query does not work SELECT order0_.* FROM Orders order0_ WHERE COALESCE(order0_.Freight, 0) > @p0; And a query with cast around coalesce works SELECT order0_.* FROM Orders order0_ WHERE CAST(COALESCE(order0_.Freight, 0) as NUMERIC) > @p0;
1 parent 62c274b commit 0254751

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

src/NHibernate.Test/Linq/ByMethod/GetValueOrDefaultTests.cs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,31 @@
11
using System.Linq;
2+
using NHibernate.Dialect;
23
using NUnit.Framework;
34

45
namespace NHibernate.Test.Linq.ByMethod
56
{
67
[TestFixture]
78
public class GetValueOrDefaultTests : LinqTestCase
89
{
10+
protected override bool AppliesTo(Dialect.Dialect dialect)
11+
{
12+
// It seems that SQLite has a nasty bug with coalesce
13+
14+
// Following query does not work
15+
// SELECT order0_.*
16+
// FROM Orders order0_
17+
// WHERE coalesce(order0_.Freight, 0) > @p0;
18+
19+
// And this one works
20+
// SELECT order0_.*
21+
// FROM Orders order0_
22+
// WHERE cast(coalesce(order0_.Freight, 0) as NUMERIC) > @p0;
23+
24+
if (dialect is SQLiteDialect)
25+
return false;
26+
return base.AppliesTo(dialect);
27+
}
28+
929
[Test]
1030
public void CoalesceInWhere()
1131
{

0 commit comments

Comments
 (0)