question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Is there a way to prevent custom function to add TypeName as the last argument?

See original GitHub issue

I’ve created custom function for PostgreSql

    [CLSCompliant(false)]
    [Sql.Function("Coalesce", InlineParameters = true, ServerSideOnly = true)]
    public static T Coalesce<T>(T first, T second)
    {
        throw new InvalidOperationException("Coalesce is server-only function");
    }

And it generates this sql

select
	Coalesce(t1.id, t2.id, uuid),
	Coalesce(t1.tc, t2.tc, TimeStamp)
from table1 t1
    full join table2 t2
        on t1.tc = t2.tc and t1.id = t2.id
;

As you can see there are uuid and TimeStamp as third arguments of Coalesce. Postgre returns ERROR: column "uuid" does not exist

How can I fix it? Any ideas?

Issue Analytics

  • State:closed
  • Created 9 months ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
sdanylivcommented, Dec 13, 2022

Not yet, we plan to do that in v5.0

0reactions
MaxLevscommented, Dec 13, 2022

Okay. I found it. There is IgnoreGenericParameters property in Sql.FunctionAttribute. It is exactly what I wanted.

Read more comments on GitHub >

github_iconTop Results From Across the Web

c++ - Function passed as template argument
I'm looking for the rules involving passing C++ templates functions as arguments. This is supported by C++ as shown by an example here:...
Read more >
Template argument deduction
Template argument deduction is used when taking an address of an overload set, which includes function templates.
Read more >
Template parameters and template arguments
When the name of a non-type template parameter is used in an expression within the body of the class template, it is an...
Read more >
Key arguments in Apollo Client
You can define a completely different format for a field's storage key by providing a custom function to keyArgs . This function takes...
Read more >
On writing functions that accept any specialization of a C++ ...
Suppose you want to write a template function that accepts any specialization of std::vector . Your first try would probably be something ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found