Skip to content

Non-persistent queries fail spuriously if they reference custom types needing OID lookup #4305

@patrickt

Description

@patrickt

I have found these related issues/pull requests

I could not find any existing examples.

Description

When passing a query with persistent: false that contains a reference to a custom Postgres data type, a spurious 26000 unnamed prepared statement does not exist error is encountered on the first try. Subsequent retries work.

Reproduction steps

I have reproduced this in https://github.com/patrickt/sqlx-bug and can confirm it returns a 26000 error in sqlx-0.9 but not in 0.8.

  1. Check out the repo
  2. DATABASE_URL=<your url here> cargo run
  3. Observe the error code 26000 in the first statement
  4. Change cargo.toml to pull in sqlx 0.8
  5. Run again, observe that you get None rather than an error

SQLx version

0.9

Enabled SQLx features

postgres, runtime-tokio

Database server and version

Postgres 17

Operating system

macOS, Linux

Rust version

1.9.6

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions