Skip to content

Allowing function calls in FROM clause / TableExpression #123

@FrigoEU

Description

@FrigoEU

We've noticed that function calls in from clauses are not supported. One of the use cases that we were looking at are bulk inserts:

insert into employee_team
select :employeeid, teamid
from unnest(:teamids::int[]) as teamid

I've tried adding it to sqltyper, but it's pretty difficult. Adding it to the TableExpression and the parser was not so hard, but fitting it into the inference phase is proving harder. Specifically, getSourceColumnsForTableExpr expects SourceColumn[] to be returned. When a function call is in the from clause, this function will also be returning VirtualField[]. Would it be the right way to change this function to be returning InferM.inferM<(SourceColumn | VirtualField)[]>?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions