Describe the bug
Discovered this one while playing around with prepared statements. The type coercion of placeholders is different between a PREPARE statement and the normal query.
I.e,
The standard select query:
SELECT $1 = 'x', $1 = s FROM t
And
The prepared statement:
PREPARE p AS SELECT $1 = 'x', $1 = s FROM t
Both diverge in their placeholder resolution, and can fail in strange ways
To Reproduce
This only appears when the types are potentially different. I.e, I saw it when the type on the table was Utf8View but literal strings are Utf8.
I did manage to replicate it using the datafusion cli.
I.e, first create a table definition (ensuring map_string_types_to_utf8view is on)
CREATE TABLE t(s VARCHAR) AS VALUES ('a');
Do the raw query (works fine):
SELECT $1 = 'x', $1 = s FROM t;
Prepare this query:
PREPARE p AS SELECT $1 = 'x', $1 = s FROM t;
This will error with:
Error during planning: Expected parameter of type Utf8, got Utf8View: Conflicting types for id $1
Expected behavior
I'd expect this to work fine
Additional context
No response
Describe the bug
Discovered this one while playing around with prepared statements. The type coercion of placeholders is different between a
PREPAREstatement and the normal query.I.e,
The standard select query:
And
The prepared statement:
Both diverge in their placeholder resolution, and can fail in strange ways
To Reproduce
This only appears when the types are potentially different. I.e, I saw it when the type on the table was
Utf8Viewbut literal strings areUtf8.I did manage to replicate it using the datafusion cli.
I.e, first create a table definition (ensuring
map_string_types_to_utf8viewis on)Do the raw query (works fine):
Prepare this query:
This will error with:
Expected behavior
I'd expect this to work fine
Additional context
No response