-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
Query: SqlFunctionExpression API review #14882
Comments
Check out especially #12757 for a fascinating (and depressing) discussion... Basically SQL Server seems to require a distinction between system and user functions - this affects both quoting and schema handling. FWIW PostgreSQL could also benefit from this distinction (we'd generate uppercase but unquoted names for system functions, so we can get Note also the EF6 function definition which also contains Just for the added context, I'm not really aware of OOP-style functions in PostgreSQL (i.e. |
(let me know if you think you need any other info) |
|
|
There is always possibility for any provider/plugin-writer/customer to extend our SQL tree and define a custom SqlFunctionExpression which supports such scenarios. There is no blockers. This is just what we provide "in-the-box". As for variadic functions, it is just same function with different number of args. I believe at translation time we know exactly how many arguments are there (from LINQ expression tree). Further, we don't have checks on number of args so you can use same functionName and pass in whatever number of args you want to print out. So variadic functions should be supported already.
|
@divega can probably provide a bit more info on IsComposable. |
Yea Sql Server is a pain. Read #12757 to understand all the nuances. What it boils down to is if we want to guarantee not to produce any potential bad sql we need to know if a custom DbFunction maps back to a UDF or built in function. It's simple enough to ask for the data, but it just presents an ugly api option to the end user which they won't understand. I'm sure we can write some thoughtfully cryptic documentation which will confuse them even more :) |
I had chat with @divega about |
Fuctions without arguments passed considered niladic. Non-niladic functions without arguments must pass empty array of args. Functions with instance are considered built in. Functions without schema are considered built in. Functions with schema are non-built-in (Schema can be null) To map a DbFunction to built-in function use HasTranslation API Resolves #12757 Resolves #14882 Resolves #15501
Fuctions without arguments passed considered niladic. Non-niladic functions without arguments must pass empty array of args. Functions with instance are considered built in. Functions without schema are considered built in. Functions with schema are non-built-in (Schema can be null) To map a DbFunction to built-in function use HasTranslation API Resolves #12757 Resolves #14882 Resolves #15501
Added IsBuiltIn flag on SqlFunctionExpression. |
In new query pipeline, in order to facilitate creating different function, currently following variations are supported. (Also there niladic version)
Following are all the constructors. (You can ignore type, typeMapping, condition parameters, they are metadata)
Is above is exhaustive? Do we need to support more variations? Is
dbo.Name
(niladic) orInstance.Name
(niladic) is useful or possible or impossible?cc: @bricelam due to SQLite & Spatial
cc: @roji due to Postgre
cc: @pmiddleton based on all the work with DbFunction + pivot + TVF.
The text was updated successfully, but these errors were encountered: