risingwavelabs/risingwave · error · UnsupportedOid

Unsupported oid

Error message

Unsupported oid {0}

What it means

UnsupportedOid is a thiserror error thrown when the Postgres-compatible type lookup encounters an OID it has no mapping for. The postgres_type module maps RisingWave DataType to Postgres type OIDs (typlen, typmod, etc.); unknown OIDs cannot be translated.

Solutions

  1. Check the OID against the supported list in postgres_type.rs and use a supported type
  2. Map the unknown OID to text/bytea as a fallback before conversion
  3. Extend the macro table with the new OID if you control the schema
Defensive patterns

Strategy: try-catch

Validate before calling

fn oid_supported(oid: i32) -> bool {
    matches!(oid, 16 | 17 | 18 | 19 | 20 | 21 | 23 | 25 | 26 | 700 | 701 | 1042 | 1043 | 1082 | 1114 | 1184 | 1700)
}

Try / catch

match DataType::from_pg_oid(oid) {
    Ok(dt) => dt,
    Err(UnsupportedOid(o)) => DataType::Varchar, // fallback mapping
}

Prevention

When it happens

Trigger: Calling `DataType::to_pg_oid` / from_oid-style conversions (or whatever builds the static OID table at src/common/src/types/postgres_type.rs) with an OID integer outside the macro-generated table, e.g. array/variant OIDs from newer extensions.

Common situations: A pgwire client requesting type info for an OID RisingWave does not support (custom types, extensions like PostGIS), or decoding a RowDescription from a real Postgres with exotic types.

Related errors


AI-assisted analysis of risingwavelabs/risingwave@6469eb736d (2026-09-11). Data as JSON: /api/errors/55416592f77e43ae. Report an issue: GitHub.

Appendix: source

Thrown at src/common/src/types/postgres_type.rs:55

            { Int16       |   21 |     1005 | int2        | int2in         |      2 }
            { Int32       |   23 |     1007 | int4        | int4in         |      4 }
            { Float32     |  700 |     1021 | float4      | float4in       |      4 }
            { Float64     |  701 |     1022 | float8      | float8in       |      8 }
            { Varchar     | 1043 |     1015 | varchar     | varcharin      |     -1 }
            { Date        | 1082 |     1182 | date        | date_in        |      4 }
            { Time        | 1083 |     1183 | time        | time_in        |      8 }
            { Timestamp   | 1114 |     1115 | timestamp   | timestamp_in   |      8 }
            { Timestamptz | 1184 |     1185 | timestamptz | timestamptz_in |      8 }
            { Interval    | 1186 |     1187 | interval    | interval_in    |     16 }
            { Decimal     | 1700 |     1231 | numeric     | numeric_in     |     -1 }
            { Jsonb       | 3802 |     3807 | jsonb       | jsonb_in       |     -1 }
            { Variant     | 1307 |     1308 | variant     | variant_in     |     -1 }
        }
    };
}

#[derive(Debug, thiserror::Error)]
#[error("Unsupported oid {0}")]
pub struct UnsupportedOid(i32);

/// Get type information compatible with Postgres type, such as oid, type length.
impl DataType {
    /// For a fixed-size type, typlen is the number of bytes in the internal representation of the type.
    /// But for a variable-length type, typlen is negative.
    /// -1 indicates a “varlena” type (one that has a length word),
    /// -2 indicates a null-terminated C string.
    ///
    /// <https://www.postgresql.org/docs/15/catalog-pg-type.html#:~:text=of%20the%20type-,typlen,-int2>
    pub fn type_len(&self) -> i16 {
        macro_rules! impl_type_len {
            ($( { $enum:ident | $oid:literal | $oid_array:literal | $name:ident | $input:ident | $len:literal } )*) => {
                match self {
                    $(
                    DataType::$enum => $len,
                    )*
                    DataType::Serial => 8,

View on GitHub (pinned to 6469eb736d)