sea-query
sea-query copied to clipboard
Add ability to select from function
Motivation
It's actually possible to select
from function, at least this is fair for postgres (e.g: select * from custom_function()
)
Moreover, AWS Aurora uses this approach (e.g: aurora_replica_status() doc)
Proposed Solutions
I think the maintainers know the best way to do this.
But perhaps it's possible to implement IntoTableRef
for Func
.
So the following code will work:
Query::select().from(Func::cust("my_func"))
In this approach, probably, make sense to rename trait IntoTableRef
I think we have had TableRef::SubQuery
i.e. from_subquery
so that you can actually SELECT * from (SELECT custom_function())
Syntactically they are different, but I think they perform the same query.
It looks like workaround & probably it may affect the query execution plan 🤔
I mean it isn't restricted, so it make sense to add such ability to SeaQuery
@DDtKey @tyt2y3 hello! I create PR.