Skip to content

Postgres explain impl: Json<[Explain; 1]> (as SQL type JSONB) is not compatible with SQL type `TEXT #1037

@Kruptein

Description

@Kruptein

Hi, I'm sure this is probably some configuration error on my end, but am not sure what to do.

I have my project compiling perfectly on my local machine with the compile-time query checks, but when I deploy it to my server I start getting these errors:

error: error occurred while decoding column 0: mismatched types; Rust type `sqlx_core::types::json::Json<[sqlx_core::postgres::connection::describe::Explain; 1]>` (as SQL type `JSONB`) is not compatible with SQL type `TEXT`
  --> src/handlers/users.rs:22:5
   |
22 | /     sqlx::query_as!(
23 | |         User,
24 | |         "INSERT INTO users (email, auth0_subject, created_at) VALUES ($1, $2, $3) RETURNING *",
25 | |         user.email.as_str(),
26 | |         user.sub.as_str(),
27 | |         chrono::Local::now().naive_local()
28 | |     )
   | |_____^
   |
   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info

I checked the schema of the users table in both my local and server db but they both just look like:

theblackrose=# SELECT column_name, data_type FROM information_schema.columns WHERE TABLE_NAME = 'users';
  column_name  |          data_type
---------------+-----------------------------
 id            | integer
 auth0_subject | text
 email         | text
 created_at    | timestamp without time zone
(4 rows)

Can someone point me in a direction to what I might be missing ?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions