Mike
Mike9mo ago

Postgres request throws ExecutionErr when trying to get value from field using enum.

We have a PostgreSQL database that we want to query. in one of the tables we use an enum as a type for one of the columns.
create type conversion_history_status_enum as enum ('done', 'failed');
create type conversion_history_status_enum as enum ('done', 'failed');
Performing just a basic SELECT status FROM conversion_history will throw this error:
ExecutionErr: error during execution of the script:
conversion issue for value at column_name `status` with type Other(Other { name: "conversion_history_status_enum", oid: 17428288, kind: Enum(["done", "failed"]), schema: "public" })
ExecutionErr: error during execution of the script:
conversion issue for value at column_name `status` with type Other(Other { name: "conversion_history_status_enum", oid: 17428288, kind: Enum(["done", "failed"]), schema: "public" })
What could be causing this? Running the same query from Datagrip for example works without any problems.
2 Replies
rubenf
rubenf9mo ago
convert it to a string status::text
Mike
Mike9mo ago
amazing, yes that works! thanks for the quick response there