Skip to content

Commit f92ee44

Browse files
authored
Register right function for Firebird and PostgreSQL (#2556)
1 parent c3380e3 commit f92ee44

File tree

4 files changed

+6
-4
lines changed

4 files changed

+6
-4
lines changed

src/NHibernate.Test/Async/Legacy/SQLFunctionsTest.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,8 +121,8 @@ public async Task DialectSQLFunctionsAsync()
121121
public async Task LeftAndRightAsync()
122122
{
123123
//left or right functions are supported by most dialects but not registered.
124-
if (!(Dialect is MsSql2000Dialect || Dialect is SQLiteDialect))
125-
Assert.Ignore("left or right function is not supported by dialect");
124+
AssumeFunctionSupported("left");
125+
AssumeFunctionSupported("right");
126126

127127
using (var s = OpenSession())
128128
using (var t = s.BeginTransaction())

src/NHibernate.Test/Legacy/SQLFunctionsTest.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,8 +110,8 @@ public void DialectSQLFunctions()
110110
public void LeftAndRight()
111111
{
112112
//left or right functions are supported by most dialects but not registered.
113-
if (!(Dialect is MsSql2000Dialect || Dialect is SQLiteDialect))
114-
Assert.Ignore("left or right function is not supported by dialect");
113+
AssumeFunctionSupported("left");
114+
AssumeFunctionSupported("right");
115115

116116
using (var s = OpenSession())
117117
using (var t = s.BeginTransaction())

src/NHibernate/Dialect/FirebirdDialect.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -525,6 +525,7 @@ private void RegisterStringAndCharFunctions()
525525
RegisterFunction("locate", new PositionFunction());
526526
RegisterFunction("replace", new StandardSafeSQLFunction("replace", NHibernateUtil.String, 3));
527527
RegisterFunction("left", new StandardSQLFunction("left"));
528+
RegisterFunction("right", new StandardSQLFunction("right"));
528529
}
529530

530531
private void RegisterBlobFunctions()

src/NHibernate/Dialect/PostgreSQLDialect.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ public PostgreSQLDialect()
6868
RegisterFunction("iif", new IifSQLFunction());
6969
RegisterFunction("replace", new StandardSQLFunction("replace", NHibernateUtil.String));
7070
RegisterFunction("left", new SQLFunctionTemplate(NHibernateUtil.String, "substr(?1,1,?2)"));
71+
RegisterFunction("right", new SQLFunctionTemplate(NHibernateUtil.String, "substr(?1, length(?1) + 1 -?2)"));
7172
RegisterFunction("mod", new ModulusFunctionTemplate(true));
7273

7374
RegisterFunction("sign", new StandardSQLFunction("sign", NHibernateUtil.Int32));

0 commit comments

Comments
 (0)