We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
#367
sqlx fails to decode any column when the column is nullable.
Say i have the following setup in my database
CREATE TABLE table_a (id UUID NOT NULL UNIQUE DEFAULT gen_random_uuid(), name TEXT NOT NULL); CREATE TABLE table_b (id UUID NOT NULL UNIQUE DEFAULT gen_random_uuid(), name TEXT NOT NULL, thing TEXT, table_a_id UUID); ALTER TABLE table_b ADD CONSTRAINT table_b_table_a_id FOREIGN KEY (table_a_id) REFERENCES table_a(id) ON DELETE CASCADE ON UPDATE CASCADE; INSERT INTO table_b (name) VALUES ('name');
Then running the following program
use sqlx::postgres::PgPoolOptions; #[tokio::main] async fn main() -> Result<(), sqlx::Error> { let pool = PgPoolOptions::new() .connect("postgres://postgres:postgres@localhost:5432/testing") .await?; let row = sqlx::query( " SELECT t.id, t.name, t.thing, t.table_a_id FROM table_b t ", ) .fetch_one(&pool) .await?; println!("ROW {:?}", row); Ok(()) }
Prints the following (I have formatted it for readability)
ROW PgRow { id: 1f0ae783-4bc1-4424-8605-89e67815f56d, name: "name", thing: (error decoding SQL type TEXT as alloc::string::String: UnexpectedNullError), table_a_id: (error decoding SQL type UUID as uuid::Uuid: UnexpectedNullError) }
0.8
runtime-tokio-rustls, postgres, json, uuid
Postgres
MacOS
1.82.0
The text was updated successfully, but these errors were encountered:
No branches or pull requests
I have found these related issues/pull requests
#367
Description
sqlx fails to decode any column when the column is nullable.
Reproduction steps
Say i have the following setup in my database
Then running the following program
Prints the following (I have formatted it for readability)
SQLx version
0.8
Enabled SQLx features
runtime-tokio-rustls, postgres, json, uuid
Database server and version
Postgres
Operating system
MacOS
Rust version
1.82.0
The text was updated successfully, but these errors were encountered: