Postgres enum values
See original GitHub issueIt seems that enum values when using postgres are not supported. Maybe even the Data API does not support enums in stringValue parameters (I just asked AWS about this).
Similar problem with jsonb type: https://github.com/jeremydaly/data-api-client/issues/34
Workaround:
I managed to get enums working by wrapping the value in a function (which tells typeorm to pass it as raw - so it avoids parameters)
example:
status: () => `'${Status.PENDING}'`,
// instead of
status: Status.PENDING,
What also works is casting (mentioned in the linked issue):
UPDATE property SET status=:status::property_status_enum
(enum name in schema is property_status_enum
and passed query parameters: {status: 'pending'}
)
Casting requires you to use raw queries which kind of goes against typeorm workflow. Could this casting be implemented in this driver or somewhere else? @ArsenyYankovsky
Issue Analytics
- State:
- Created 3 years ago
- Reactions:6
- Comments:28 (11 by maintainers)
Top Results From Across the Web
Documentation: 15: 8.7. Enumerated Types - PostgreSQL
Enumerated (enum) types are data types that comprise a static, ordered set of values. They are equivalent to the enum types supported in...
Read more >SQL query to get all values a enum can have - Stack Overflow
You can get all the enum values for an enum using the following query. The query lets you pick which namespace the enum...
Read more >Looking up Enum types and values in Postgres - Sadique Ali
Postgres ' Enum, like their counterparts in many programming languags are data types that allow only a predefined set of values to be...
Read more >Dealing with Enum Type in PostgreSQL - DEV Community
It is treated as type in PostgreSQL · It applies to all tables in same schema · It has static values · Enum...
Read more >How enum Works in PostgreSQL? (Examples) - eduCBA
PostgreSQL enum is the data type that was used in PostgreSQL to store same type of values in the column field, we can...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Would love this feature too @ArsenyYankovsky
@seawatts @davingreen I just released a driver with a fix for this (2.0.4). You also don’t have to use my fork anymore since new TypeORM 0.3.32 was released. Feel free to comment here or open a new issue if something doesn’t work.