mirror of https://github.com/citusdata/citus.git
Merge pull request #3625 from citusdata/avoid-execinitexpr-sublink
PartiallyEvaluateExpression: Avoid unrecognized paramkind: 2pull/3591/head
commit
f77c71a9bd
|
@ -27,7 +27,7 @@
|
||||||
|
|
||||||
|
|
||||||
/* private function declarations */
|
/* private function declarations */
|
||||||
static bool IsVarNode(Node *node);
|
static bool IsVarOrParamSublink(Node *node);
|
||||||
static Expr * citus_evaluate_expr(Expr *expr, Oid result_type, int32 result_typmod,
|
static Expr * citus_evaluate_expr(Expr *expr, Oid result_type, int32 result_typmod,
|
||||||
Oid result_collation,
|
Oid result_collation,
|
||||||
MasterEvaluationContext *masterEvaluationContext);
|
MasterEvaluationContext *masterEvaluationContext);
|
||||||
|
@ -120,7 +120,8 @@ PartiallyEvaluateExpression(Node *expression,
|
||||||
else if (ShouldEvaluateExpressionType(nodeTag) &&
|
else if (ShouldEvaluateExpressionType(nodeTag) &&
|
||||||
ShouldEvaluateFunctionWithMasterContext(masterEvaluationContext))
|
ShouldEvaluateFunctionWithMasterContext(masterEvaluationContext))
|
||||||
{
|
{
|
||||||
if (FindNodeCheck(expression, IsVarNode))
|
/* don't call citus_evaluate_expr on nodes it cannot handle */
|
||||||
|
if (FindNodeCheck(expression, IsVarOrParamSublink))
|
||||||
{
|
{
|
||||||
return (Node *) expression_tree_mutator(expression,
|
return (Node *) expression_tree_mutator(expression,
|
||||||
PartiallyEvaluateExpression,
|
PartiallyEvaluateExpression,
|
||||||
|
@ -200,11 +201,17 @@ ShouldEvaluateExpressionType(NodeTag nodeTag)
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* IsVarNode returns whether a node is a Var (column reference).
|
* IsVarOrParamSublink returns whether node is a Var or PARAM_SUBLINK param.
|
||||||
*/
|
*/
|
||||||
static bool
|
static bool
|
||||||
IsVarNode(Node *node)
|
IsVarOrParamSublink(Node *node)
|
||||||
{
|
{
|
||||||
|
if (IsA(node, Param))
|
||||||
|
{
|
||||||
|
/* ExecInitExpr cannot handle PARAM_SUBLINK */
|
||||||
|
return ((Param *) node)->paramkind == PARAM_SUBLINK;
|
||||||
|
}
|
||||||
|
|
||||||
return IsA(node, Var);
|
return IsA(node, Var);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2363,7 +2363,7 @@ INSERT INTO articles_hash VALUES (51, 1, 'amateus', 1814), (52, 1, 'second amate
|
||||||
DEBUG: Creating router plan
|
DEBUG: Creating router plan
|
||||||
DEBUG: Plan is router executable
|
DEBUG: Plan is router executable
|
||||||
DETAIL: distribution column value: 1
|
DETAIL: distribution column value: 1
|
||||||
-- verify insert is successfull (not router plannable and executable)
|
-- verify insert is successful (not router plannable and executable)
|
||||||
SELECT id
|
SELECT id
|
||||||
FROM articles_hash
|
FROM articles_hash
|
||||||
WHERE author_id = 1;
|
WHERE author_id = 1;
|
||||||
|
@ -2381,6 +2381,12 @@ DETAIL: distribution column value: 1
|
||||||
52
|
52
|
||||||
(7 rows)
|
(7 rows)
|
||||||
|
|
||||||
|
-- https://github.com/citusdata/citus/issues/3624
|
||||||
|
UPDATE articles_hash SET id = id
|
||||||
|
WHERE author_id = 1 AND title IN (SELECT name FROM authors_reference WHERE random() > 0.5);
|
||||||
|
DEBUG: Creating router plan
|
||||||
|
DEBUG: Plan is router executable
|
||||||
|
DETAIL: distribution column value: 1
|
||||||
SET client_min_messages to 'NOTICE';
|
SET client_min_messages to 'NOTICE';
|
||||||
-- test that a connection failure marks placements invalid
|
-- test that a connection failure marks placements invalid
|
||||||
SET citus.shard_replication_factor TO 2;
|
SET citus.shard_replication_factor TO 2;
|
||||||
|
|
|
@ -1096,11 +1096,15 @@ SELECT id
|
||||||
-- insert query is router plannable even under task-tracker
|
-- insert query is router plannable even under task-tracker
|
||||||
INSERT INTO articles_hash VALUES (51, 1, 'amateus', 1814), (52, 1, 'second amateus', 2824);
|
INSERT INTO articles_hash VALUES (51, 1, 'amateus', 1814), (52, 1, 'second amateus', 2824);
|
||||||
|
|
||||||
-- verify insert is successfull (not router plannable and executable)
|
-- verify insert is successful (not router plannable and executable)
|
||||||
SELECT id
|
SELECT id
|
||||||
FROM articles_hash
|
FROM articles_hash
|
||||||
WHERE author_id = 1;
|
WHERE author_id = 1;
|
||||||
|
|
||||||
|
-- https://github.com/citusdata/citus/issues/3624
|
||||||
|
UPDATE articles_hash SET id = id
|
||||||
|
WHERE author_id = 1 AND title IN (SELECT name FROM authors_reference WHERE random() > 0.5);
|
||||||
|
|
||||||
SET client_min_messages to 'NOTICE';
|
SET client_min_messages to 'NOTICE';
|
||||||
|
|
||||||
-- test that a connection failure marks placements invalid
|
-- test that a connection failure marks placements invalid
|
||||||
|
|
Loading…
Reference in New Issue