Active
Project:
DBLIB driver for SQL Server
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
11 Dec 2014 at 15:01 UTC
Updated:
11 Dec 2014 at 15:01 UTC
The DatabaseConnection_dblib->preprocessQuery method currently adds the defaultSchema prefix to the following functions:
$functions = array(
'SUBSTRING',
'SUBSTRING_INDEX',
'GREATEST',
'CONCAT',
'IF',
);
This causes queries using SUBSTRING to fail with a 4121 error:
Msg 4121, Level 16, State 1, Line 1
Cannot find either column "dbo" or the user-defined function or aggregate "dbo.SUBSTRING", or the name is ambiguous.
As SUBSTRING is a built-in function available in SqlServer 2008 and higher, it is sufficient to simply remove SUBSTRING from the array of functions to be schema prefixed (i.e. delete line 291 in database.inc)