-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Closed
Labels
Description
For table called my_table with id -> Integer, value-> Integer and data->BYTEA (Postgress)
the following macro seems to fail when trying to insert a record (without BYTEA it seemed to work)
Fails with: "error: "unknown type param ID: 17""
let id : i32 = 2;
let value : i32 = 100;
let v: Vec<u8> = vec![0, 2, 4, 6];
let row = sqlx::query( r#"
INSERT INTO transactions ( id , value, data)
VALUES ( $1, $2 , $3)
RETURNING id, value, signature_or_message
"#,)
.bind(id).bind(value).bind(v)
.fetch_one(&mut tx)
.await.unwrap();
tx.commit().await.unwrap();
This works fine:
let id : i32 = 2;
let value : i32 = 100;
let v: Vec<u8> = vec![0, 2, 4, 6];
let rec = sqlx::query!(
r#"
INSERT INTO transactions ( id , value, signature_or_message)
VALUES ( $1, $2 , $3)
RETURNING id, value, signature_or_message
"#,
0,
0,
v
)
.fetch_one(&mut tx)
.await
.unwrap();
tx.commit().await.unwrap();