sqltyper icon indicating copy to clipboard operation
sqltyper copied to clipboard

Allowing function calls in FROM clause / TableExpression

Open FrigoEU opened this issue 3 years ago • 0 comments

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)[]>?

FrigoEU avatar Mar 23 '21 11:03 FrigoEU