Unable to retrieve array column due to SQL type mismatch: as SQL type ...[]
is not compatible with SQL type _...
#3204
Labels
...[]
is not compatible with SQL type _...
#3204
Bug Description
In postgres, when utilizing arrays of a custom type, the driver rejects retrieving a column from a row if the
PgTypeInfo
forPgHasArrayType
is implemented using the[]
syntax. The underlying implementation in postgres stores this array implementation on custom types using a underscore prefix. This does not occur when reading the array out through the query macro.I get the following failure:
It was quite surprising behavior, as I was unaware of the actual type name of the postgres enum array - I've always referred to it through the
[]
syntax. I neither saw any traces of this scenario mentioned in the Types nor PgHasArrayType documentation.Is this expected behavior? Could this scenario be attempted auto-detected for postgres? Or perhaps only a clarification in the documentation of postgres enums when implementing
PgHasArrayType
?Minimal Reproduction
This is the debug print of the column info for the select query:
Info
rustc --version
: rustc 1.77.1 (7cf61ebde 2024-03-27)The text was updated successfully, but these errors were encountered: