On 28/06/2024 01:01, Paul Jungwirth wrote:
If it seems good to let people use SupportRequestSimplify to make their SRFs be
inlineable, I'm
happy to add tests and docs. We should really document the idea of inlined
functions in general, so
I'll do that too.
Another approach I considered is using a separate support request, e.g.
SupportRequestInlineSRF, and
just calling it from inline_set_returning_function. I didn't like having two
support requests that
did almost exactly the same thing. OTOH my current approach means you'll get an
error if you do this:
```
postgres=# select temporal_semijoin('employees', 'id', 'valid_at', 'positions',
'employee_id',
'valid_at');
ERROR: unrecognized node type: 66
```
I'll look into ways to fix that.
If the support function returns a Query, we end up having a FuncExpr
with a Query in the tree. A Query isnt an Expr, which is why you get
that error, and it seems like a recipe for confusion in general. Perhaps
returning a SubLink would be better.
I think we should actually add an assertion after the call to the
SupportRequestSimplify support function, to check that it returned an
Expr node.
+1 to the general feature of letting SRFs be simplified by the support
function.
I think SupportRequestSimplify is a really cool feature. It is nearly like
having macros.
I'm dreaming about other ways I can (ab)use it.
:-D
--
Heikki Linnakangas
Neon (https://neon.tech)