Description
This is on tokio-postgres 0.7.2
.
I am dynamically constructing insert queries like the following (without the linebreak in between; just here for formatting):
INSERT INTO trades VALUES
($1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13,$14,$15,$16,$17,$18,$19,$20),
($21,$22,$23,$24,$25,$26,$27,$28,$29,$30,$31,$32,$33,$34,$35,$36,$37,$38,$39,$40);
However, when I then try to execute a statement with an iterator that contains the right number of elements, e.g. rows
contains 40 dyn ToSql
trait objects in client.execute_raw(&*insertion_query, rows.into_iter()).await?;
I am getting the following error:
thread 'main' panicked at 'expected 20 parameters but got 40', /home/janis/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-postgres-0.7.2/src/query.rs:160:5
I was following this suggestion (for various reasons I cannot use the COPY FROM STDIN
syntax): #336 (comment)
I have tried to explicitly name the columns I am inserting into, but the error remains the same.
EDIT: Is query parsing actually done by the server? If so, it might be that my database (questdb), although it claims compatibility with postgres, does not support multirows insertion syntax and hence gives an incorrect parse.