ParamsToString() in GET table filters missing apostrophes in VARCHAR fields #11729
Description
What happens?
The ParamsToString() function does not properly convert VARCHAR fields (missing the apostrophes) when being called on the table filters of LOGICAL_GET
nodes. This would be useful because I am implementing new optimizer rules turning (modified) logical plans back to SQL strings (within incremental view maintenance, for example). Tested with the last commit of DuckDB.
To Reproduce
create table test(id1 int, id2 string);
insert into test values (1, 'a'), (2, 'b'), (3, 'c');
explain update test set id1 = 4 where id2 = 'a';
┌─────────────────────────────┐
│┌───────────────────────────┐│
││ Physical Plan ││
│└───────────────────────────┘│
└─────────────────────────────┘
┌───────────────────────────┐
│ UPDATE │
└─────────────┬─────────────┘
┌─────────────┴─────────────┐
│ PROJECTION │
│ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ │
│ 4 │
│ #0 │
└─────────────┬─────────────┘
┌─────────────┴─────────────┐
│ SEQ_SCAN │
│ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ │
│ test │
│ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ │
│ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ │
│ Filters: id2=a AND id2 IS │
│ NOT NULL │
│ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ │
│ EC: 1 │
└───────────────────────────┘
Desired output:
Filters: id2='a' AND id2 IS NOT NULL
in the bottom node.
Basically I need strings to be properly enclosed between apostrophes ('a'
and not a
). I can try and fix it myself if it's too much of a hassle - or alternatively please let me know if this is the intended behaviour, such that I will implement a workaround.
OS:
Ubuntu 23.10
DuckDB Version:
10
DuckDB Client:
shell
Full Name:
Ilaria Battiston
Affiliation:
CWI
What is the latest build you tested with? If possible, we recommend testing with the latest nightly build.
I have tested with a source build
Did you include all relevant data sets for reproducing the issue?
Yes
Did you include all code required to reproduce the issue?
- Yes, I have
Did you include all relevant configuration (e.g., CPU architecture, Python version, Linux distribution) to reproduce the issue?
- Yes, I have