Not Support data type: super in AWS Redshift
I have found these related issues/pull requests
I haven't found similar issues
Description
If a field in the query statement is of super data-type an error is reported: error returned from database: cannot cast type regtype to character varying
Reproduction steps
let mut stream = sqlx::query(sql).fetch(&*POOL).take(limit);
let mut values = vec![];
while let Some(res) = stream.next().await {
match res {
Ok(row) => values.push(row_to_value(&row)),
Err(err) => tracing::error!(%err),
}
}
Ok(values)
SQLx version
0.8.3
Enabled SQLx features
"runtime-tokio-rustls", "postgres", "chrono", "bigdecimal"
Database server and version
AWS Redshift
Operating system
linux
Rust version
rustc 1.87.0-nightly (f04bbc60f 2025-02-20)
Redshift doesn't support object identifier types, so we can't perform any of the introspection queries we normally do to get information about a type: https://github.com/launchbadge/sqlx/blob/154878547e7e78c42bf97a34dccd745edbce2ef3/sqlx-postgres/src/connection/describe.rs#L204
Fortunately, Redshift also doesn't support any custom types (although that page doesn't explicitly exclude domain types?), so we normally shouldn't need to perform those queries.
It's just the SUPER type that's throwing us for the loop here. We could just detect when we're connected to a Redshift database and return a constant PgTypeInfo for the SUPER type.
Unfortunately, however, they don't document what type ID they use to represent SUPER over the wire, nor do they specify what the wire image for SUPER looks like. I'd assume it just always uses text format, but I have no idea which text format to expect.
I imagine this also applies to the HLLSKETCH type since it's not a standard catalog type either.
Workaround
Just cast the super type column to the appropriate scalar value. You may need to restructure your query and have multiple columns doing IS_* tests.