Replies: 2 comments
-
Looking for an answer to the same problem. Have you had any success? |
Beta Was this translation helpful? Give feedback.
0 replies
-
Looks like there is work around here: #571 (comment) |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Context
I am using Postgres 15 and sqxl 0.6.2 with features
["runtime-tokio-native-tls", "postgres", "uuid", "time"]
although the latter two seem irrelevant to this issue.Question
I am having difficulty bulk inserting a struct which has an
Option<String>
into my database usingUNNEST
. I followed the example in the FAQ to do bulk inserts. My code works when I don't insert theOption<String>
.I can get the query to go through when using
query_unchecked!()
but I'd prefer to not have to resort to that.Error message
Look at the Repro section below for context. I changed the names to match my minimum repro.
What I tried
Using
query_unchecked!
works.I found the PgHasArrayType while poking around in the docs and thought maybe I needed to tell sqlx that you can have arrays of
Option<String>
, but there seems to be one forOption<T>
already.I've tried queries without the
Option<String>
and they work. I've also observed that single insertions without theUNNEST
work, so it seems like I'm doing something wrong with the array. I've also tried to force postgres to infer/accept the type with some hacks I found, but that didn't work either.Repro
This is my best attempt at a minimum repro but I didn't want to init an entire project to test it. It's very close to my code so it should be right. I can make an actual repo with the repro if needed.
./migrations/0_app_user_table.sql
./src/app_user.rs
Beta Was this translation helpful? Give feedback.
All reactions