Page 1 of 1

Substring in combination with Array results in wrong SQL (Oracle)

Posted: Tue 26 Jul 2022 11:27
by Flo
If you use a substring in combination with an array (in c#) devart creates wrong SQL.
Here are some (pseudo) code to reproduce:

Code: Select all

var array = new string[] { "23", "71" };
var query = this.DataContext.MyState.Where(x => array.Contains(x.Value.Substring(0, 2)));
var q = query.ToQueryString();
First call is correct, it generates:

Code: Select all

SELECT "f".ID, "f".VALUE
FROM MYSTATE "f"
WHERE SUBSTR("f".VALUE, 0 + 1, 2) IN ('23', '71')
but second looks like:

Code: Select all

SELECT "f".ID, "f".VALUE
FROM MYSTATE "f"
WHERE SUBSTR("f".VALUE, (0 + 1) + 1, 2) IN ('23', '71')
and the next one will be:

Code: Select all

SELECT "f".ID, "f".VALUE
FROM MYSTATE "f"
WHERE SUBSTR("f".VALUE, (((0 + 1) + 1) + 1) + 1, 2) IN ('23', '71')
and so forth.
Looks like an static variable which get increased every call.
Version was Devart.Data.Oracle.EFCore Version=9.16.1434, also the Version 10 has the same bug.

Re: Substring in combination with Array results in wrong SQL (Oracle)

Posted: Wed 31 Aug 2022 06:16
by Flo
Hello @devart,

have you check the issue and can confirm it?
When will it be fixed?

Re: Substring in combination with Array results in wrong SQL (Oracle)

Posted: Wed 05 Oct 2022 12:36
by Shalex
Thank you for your report. We have reproduced the described behavior and will notify you about the results of our investigation.