Skip to content

Not Support data type: VARBYTE in AWS Redshift #4384

Description

@realonbebeto

I have found these related issues/pull requests

None

Description

Selecting a VARBYTE column from Redshift causes sqlx to return SELECT DISTINCT ON is not supported, even though the query does not use DISTINCT ON.

Reproduction steps

  1. Create/use a Redshift table with a VARBYTE column named payload.
  2. Run:
    let pool = PgPoolOptions::new()
        .max_connections(1)
        .connect_with(
            PgConnectOptions::from_str(
                "postgresql://admin:XXXXXXXXX@iggy-wg.087767584429.us-east-1.redshift-serverless.amazonaws.com:5439/dev"
            ).unwrap()
            .statement_cache_capacity(0)
        )
        .await.unwrap();

let query = sqlx::AssertSqlSafe(
    "SELECT payload FROM \"iggy_messages\" ORDER BY iggy_offset"
);

let result = sqlx::query(query).fetch_all(&pool).await.unwrap();
  1. Observe:
Database(PgDatabaseError {
    severity: Error,
    code: "0A000",
    message: "SELECT DISTINCT ON is not supported",
    ...
})

Removing payload from the SELECT makes the query work.

SQLx version

0.9.0

Enabled SQLx features

runtime-tokio, tls-rustls, postgres, chrono, uuid, json

Database server and version

Amazon Redshift Serverless

Operating system

Mac OS

Rust version

rustc 1.97.1 (8bab26f4f 2026-07-14)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions