Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Relational: UDF calls are generated unquoted #9558

Closed
anpete opened this issue Aug 24, 2017 · 2 comments
Closed

Relational: UDF calls are generated unquoted #9558

anpete opened this issue Aug 24, 2017 · 2 comments
Assignees
Labels
closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. type-bug
Milestone

Comments

@anpete
Copy link
Contributor

anpete commented Aug 24, 2017

When we generate a call to a user defined database function, the function name is unquoted. Should it be?

SELECT [dbo].EmployeeOrderCount(@__employeeId_0)
FROM [Employees] AS [e]
@ajcvickers ajcvickers added this to the 2.1.0 milestone Aug 25, 2017
@pmiddleton
Copy link
Contributor

You can create UDFs with keywords and spaces in their names so we should deal with it.

Of course there is a slight problem - Sql Server does not treat built-in functions the same as UDFs. Built in functions cannot be escaped, unless I as missing some esoteric syntax, and doing so will cause a syntax error.

This means we need some way to differentiate built-in and UDF functions. We are going to either have to ask for this information in the db function fluent api, or keep a list of all built-in functions. Keeping a list up to date will be nigh impossible so I'm leaning towards modifying the fluent api.

Anyone have any other ideas?

@bricelam - From my quick test it appears Sqlite does not have this same issue. Can you confirm.

Delimiting the function name in relational may break providers for other databases, depending on how their syntax works. Should we make this a Sql Server only change, or make the change in relational and let each provider override if needed?

@bricelam
Copy link
Contributor

bricelam commented Aug 28, 2017

Sqlite does not have this same issue

Not as far as I can tell. Heck, it lets you redefine the built-in functions, so I'd be surprised if they were ever treated differently.

@ajcvickers ajcvickers modified the milestones: 2.1.0-preview1, 2.1.0 Jan 17, 2018
anpete added a commit that referenced this issue Feb 2, 2018
Tweak SQL gen to delimit function calls that have a schema.
@anpete anpete closed this as completed in 168145c Feb 5, 2018
@anpete anpete added the closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. label Feb 6, 2018
roji added a commit to roji/efcore.pg that referenced this issue Jul 22, 2018
Function quoting logic was changed (for now): all function names are
quoted just like any other identifier (the default EF Core behavior
is only to quote schema-less functions). This meant changing all
expression translators to generate lower-case names (lower() instead
of LOWER()), and also to add a hardcoded list of functions which
EF Core generates in upper-case but which shouldn't get quoted
(e.g. SUM()).

See:
* dotnet/efcore#8507
* dotnet/efcore#12044
* dotnet/efcore#12757
* dotnet/efcore#9558
* dotnet/efcore#9303
roji added a commit to roji/efcore.pg that referenced this issue Aug 3, 2018
Function quoting logic was changed (for now): all function names are
quoted just like any other identifier (the default EF Core behavior
is only to quote schema-less functions). This meant changing all
expression translators to generate lower-case names (lower() instead
of LOWER()), and also to add a hardcoded list of functions which
EF Core generates in upper-case but which shouldn't get quoted
(e.g. SUM()).

See:
* dotnet/efcore#8507
* dotnet/efcore#12044
* dotnet/efcore#12757
* dotnet/efcore#9558
* dotnet/efcore#9303
roji added a commit to roji/efcore.pg that referenced this issue Aug 12, 2018
For now, only unquoted function names are supported (i.e. all lower-
case, no special chars). Quoting logic for functions is quite
complicated, see below issues for details.

See:
* dotnet/efcore#8507
* dotnet/efcore#12044
* dotnet/efcore#12757
* dotnet/efcore#9558
* dotnet/efcore#9303
roji added a commit to roji/efcore.pg that referenced this issue Aug 12, 2018
For now, only unquoted function names are supported (i.e. all lower-
case, no special chars). Quoting logic for functions is quite
complicated, see below issues for details.

See:
* dotnet/efcore#8507
* dotnet/efcore#12044
* dotnet/efcore#12757
* dotnet/efcore#9558
* dotnet/efcore#9303
roji added a commit to roji/efcore.pg that referenced this issue Aug 12, 2018
For now, only unquoted function names are supported (i.e. all lower-
case, no special chars). Quoting logic for functions is quite
complicated, see below issues for details.

See:
* dotnet/efcore#8507
* dotnet/efcore#12044
* dotnet/efcore#12757
* dotnet/efcore#9558
* dotnet/efcore#9303
@ajcvickers ajcvickers modified the milestones: 2.1.0-preview2, 2.1.0 Nov 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. type-bug
Projects
None yet
Development

No branches or pull requests

4 participants