The error also does not occur when we remove the not null from the table definition. However, the types are not correct:
CREATETABLETest (c1 int, c2 varchar(255), c3 int);
INSERT INTO Test VALUES (1, 'asd', 1);
PREPARE INSERT INTO Test
SELECT c1, ?, ?
FROM Test;
> execute prepared statement using: EXEC 0(...)
+------+--------+-------+--------+-------+--------+
| type | digits | scale | schema | table | column |
+======+========+=======+========+=======+========+
| int | 32 | 0 | null | null | null | -- should be varchar
| int | 32 | 0 | null | null | null |
+------+--------+-------+--------+-------+--------+
And if we try to use the prepared statement:
-- trying to pass a string to c2
EXEC 0('asd', 1);
> conversion of string 'asd' to type int failed.
-- or trying to pass an integer to c2
EXEC 0(1, 1);
> Append failed
Software versions
MonetDB v11.43.0 (Jan22 branch)
Ubuntu 20.04
Self-installed and compiled
The text was updated successfully, but these errors were encountered:
Describe the bug
When preparing a statement of inserts with selects, the prepare fails when the parameters have different types.
To Reproduce
Create the test table and add some data:
Create a prepared statement of a insert with select:
Additional notes
If both parameters have the same type, the prepare works correctly. E.g.:
The error also does not occur when all the columns are custom parameters, i.e.:
The error also does not occur when we remove the
not nullfrom the table definition. However, the types are not correct:And if we try to use the prepared statement:
Software versions
The text was updated successfully, but these errors were encountered: