Repository navigation
Evaluate functions on master - #488
Conversation
It's better to avoid it if at all possible, but we copy a lot of code from postgres (grep -r INDENT-OFF for examples). I don't think evaluate_expr is suitable for evaluating volatile functions that modify the database. You should probably look at ExecEvalExpr. |
|
|
||
| Oid relid = ((RangeTblEntry *) linitial(queryTree->rtable))->relid; | ||
| List *deparseContext = deparse_context_for("table", relid); | ||
|
|
There was a problem hiding this comment.
I think the same rules apply in the WHERE clause.
73e2f10 to
dccdec3
Compare
|
Brian Cloutier (@lithp) Whats the status here? Do you have a time estimate for this change? Does this fix #211 as well? |
ca25e7d to
a3de24a
Compare
|
Brian Cloutier (@lithp) Assigning Andres Freund (@anarazel) as reviewer. There are a couple of todo's which are not checked. Is the PR still ready to go? |
|
Sumedh Pathak (@sumedhpathak) I think it's ready to be reviewed :) |
|
|
||
| /* drop into the router executor */ | ||
| RouterExecutorRun(queryDesc, direction, count, task); | ||
| RouterExecutorRun(queryDesc, direction, count); |
There was a problem hiding this comment.
Don't worry this time, but generally mixing mostly unrelated refactoring in with functional changes, makes the whole harder to review.
There was a problem hiding this comment.
You're right it wasn't necessary but it led to a small performance improvement, I didn't have to call GetMultiPlan multiple times. It probably should have been broken out into a separate commit, I'll be more careful.
There was a problem hiding this comment.
That's fine. Just put in a separate commit with that explanation next time round.
There was a problem hiding this comment.
He. Didn't now evaluable is an actual word. But it is. :)
|
Brian Cloutier (@lithp) I made a few, fairly minor, comments. Shouldn't be too hard to address. Close to the finishing line imo. |
|
Andres Freund (@anarazel) I think this last commit addresses all your comments |
- Enables using VOLATILE functions (like nextval()) in INSERT queries - Enables using STABLE functions (like now()) targetLists and joinTrees UPDATE and INSERT can now contain non-immutable functions. INSERT can contain any kind of expression, while UPDATE can contain any STABLE function, so long as a Var is not passed into the STABLE function, even indirectly. UPDATE TagetEntry's can now also include Vars. There's an exception, CASE/COALESCE statements may not contain mutable functions. Functions calls in master_modify_multiple_shards are also evaluated.
3789e70 to
4cf0a4e
Compare
|
Hm. I think the adjustment to master_modify_multiple_shards() isn't correct. The planner hasn't verified that the requirements for function evaluation are fulfilled. I'm pulling that part out, it doesn't seem quite right; and is separate functionality. |
|
Ah, scratch that. Sorry for the noise. |
|
And yay, merged! |
Hey Brian Cloutier (@lithp), Lukas Fittl (@lfittl) was asking about the error we emit when someone attempts to use a function in a partition column slot. I don't think we should put too much polish into it, as I expected we'd plan to eventually permit such functions (evaluate on master before pruning). Is there an issue open for eventually supporting master-evaluated functions in partition slots? I couldn't find it. Thanks! |
|
Jason Petersen (@jasonmp85) Brian Cloutier (@lithp) FWIW, I couldn't find any issue related to this, so I've opened #687 |
Evaluate functions on master
Adds support for:
Decisions made:
jointree->qualsare allowed to have mutable functionsIf you enable DEBUG4 then some output is logged with the results of function evaluation.
Fixes #213