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

FromRaw can't translate list type parameter properly #704

Open
Revazashvili opened this issue Feb 2, 2024 · 1 comment
Open

FromRaw can't translate list type parameter properly #704

Revazashvili opened this issue Feb 2, 2024 · 1 comment

Comments

@Revazashvili
Copy link

Dabatase: Postgres

Function body sample:

create function code__search(p_lang_code text, p_search_text text, p_type_ids integer[])
    returns TABLE(id bigint, name text)
    language sql
as
...

Code Sample for calling function:

public async Task SearchCodes(string langCode, int pageNumber, int pageSize, string searchText, List<int> typeIds,
            CancellationToken cancellationToken)
        {
            var query = GetSqlKataQuery()
                .FromRaw($"public.code__search(?,?,?)", langCode, searchText, typeIds)
                .OrderByRaw("[lower] (name)")
                .Skip(pageNumber * pageSize)
                .Take(pageSize);
            
            using var cmd = await GetSqlCommandAsync(query, cancellationToken);
            {
                 await cmd.ExecuteReaderAsync<DtoItemWithName<long>>(cancellationToken);
            }
        }

calling function throws error: function public.code__search(text, unknown, integer[], integer) does not exist.

Generated Sql: SELECT * FROM public.code__search(?,?,?,?) ORDER BY "lower" (name) LIMIT ? OFFSET ?

RawSql: SELECT * FROM public.code__search(@p0,@p1,@p2,@p3) ORDER BY "lower" (name) LIMIT @p4 OFFSET @p5

SqlResult retured from PostgresCompiler Compile method:
image

FromRaw take params object[] bindings as second parameter and can't translate List<int> as separate parameter for postgres function.

is there any way to call function like this? it needs method something like AddParameter to pass parameters in query or some type of support for calling functions and procedures

@ahmad-moussawi
Copy link
Contributor

related #274

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants