I’d like to create an enum TYPE to constrain a pl/pgsql function to accept an argument that’s 1, 2, or 3. Enum types seemed like the way to go about this. I’ve tried creating my enum as below: Answer According to the PostgreSQL documentation, an ENUM type is always going to be a fixed value: An enum value occupies four
Tag: enums
PostgreSQL conditional ENUM
Let’s say I have a table inventory with columns item_id, category and size. item_id is auto incremented integer (primary key) category is ENUM size is ENUM I want size to be a conditional ENUM. …
How to insert data with custom enum type from a csv into an existing PostgreSQL table
I want to insert data from a csv file into an existing table on a PostgreSQL database – let’s call the table automobile. One of my field is a custom enum – let’s call it brand. When I try to import records from a csv file with DataGrip built-in feature I got an error message: Yet in the following screenshot
SQL: error when creating a foreign table that has an enum column
I’m creating a foreign table (foo_table) in database_a. foo_table lives in database_b. foo_table has an enum (bar_type) as one of its columns. Because this enum is in database_b, the creation of the foreign table fails in database_a. database_a doesn’t understand the column type. Running the following in database_a CREATE FOREIGN TABLE foo_table (id integer NOT NULL, bar bar_type) SERVER database_b