Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bad planner tree sent to executor in some MULTIEXPR scenario #7676

Open
c2main opened this issue Aug 26, 2024 · 1 comment
Open

bad planner tree sent to executor in some MULTIEXPR scenario #7676

c2main opened this issue Aug 26, 2024 · 1 comment

Comments

@c2main
Copy link
Contributor

c2main commented Aug 26, 2024

While working on #7675 I found another bug:

CREATE TABLE test_ref_multiexpr (
    id bigint primary key
  , col_int integer
  , col_bool bool
  , col_text text
  , col_timestamp timestamp
  );
select create_reference_table('test_ref_multiexpr');
 create_reference_table
---------------------------------------------------------------------

(1 row)

insert into test_ref_multiexpr values (1, 1, true, 'one', now());
set client_min_messages to 'DEBUG4';

update test_ref_multiexpr
SET (col_timestamp)
  = (SELECT now())
returning id, col_int, col_bool;

ERROR:  unrecognized paramkind: 3

In citus_clauses.c, citus_evaluate_expr() is based on PostgreSQL executor to evaluate expressions, and (if I understood correctly), it'll execute function on local node before sending to other nodes, so we have the same value (now() being a good example).

The problem is similar to the other bug but at a distinct stage: citus is feeding an executor with an half processed rewriter tree which is not yet a planner tree good enough for being an executor tree. This pramkind:3 error is because in executor we do not handle MULTIEXPR, I think here it should already been computed and flatten.

Using the executor works well overall, I'm still unsure on the "good fix" for this case, as it looks like rewriting this part is essentially what has been avoided by using the executor in the first place...

It's tempting to just use upstream code like it's done in ruleutils, but with clauses.c or setrefs.c or similar upstream code...

Suggestions welcome!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants
@c2main and others