You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
Query parsing is done entirely on the server, yeah. We send the string over, and the server sends back how many parameters there are and what their types are expected to be.
Alright, closing this after verifying with upstream (= the questdb devs): questdb does not support postgres multirow syntax, so that's where the issue comes from. The problem has nothing to do with rust-postgres. Sorry for the noise.
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):
However, when I then try to execute a statement with an iterator that contains the right number of elements, e.g.
rows
contains 40dyn ToSql
trait objects inclient.execute_raw(&*insertion_query, rows.into_iter()).await?;
I am getting the following error: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.
The text was updated successfully, but these errors were encountered: