pg-mem
pg-mem copied to clipboard
Unable to parse multi values Enum array to string
Describe the bug
I have multi value enum array which should be parsed as {value1, value2}
but they are being parsed as ['value1', 'value2'] hence Typeorm throws error in this file .
(pg-mem tries to throw nice error messages when possible... so paste it here if you have one !)
The error is thrown by Typeorm
To Reproduce
Query Results with Pg-mem:
{
listings_id: 'list_OG2fN5IUruoft0Mh',
listings_created: 2021-08-16T00:05:57.000Z,
listings_updated: 2022-04-19T09:51:25.975Z,
listings_deactivated: null,
listings_deleted: null,
listings_type: 'Product',
listings_currency: 'USD',
listings_tags: [ 'Sold' ]
}
Query results with Typeorm repository
{
listings_id: 'list_OG2fN5IUruoft0Mh',
listings_created: 2021-08-16T00:05:57.000Z,
listings_updated: 2022-04-19T09:51:25.975Z,
listings_deactivated: null,
listings_deleted: null,
listings_type: 'Product',
listings_currency: 'USD',
listings_tags: '{Sold}'
}
"If possible, paste here (including create table statements) a query that fails on https://oguimbal.github.io/pg-mem-playground/, but suceeds when ran on an actual PG database"
pg-mem version
2.4.3
(nb: the version in your package.json version is often not precise enough... please run "cat ./node_modules/pg-mem/package.json | grep version" to tell which minor version is actually installed)
I'm seeing this as well in 2.5.0
It's because node-postgres doesn't parse enum arrays by default brianc/node-pg-types#56. @oguimbal Is there a way to disable parsing of enum arrays?
Running into this problem, as well.
This is blocking us from using it with Typeorm. @oguimbal can anything be done about this?
Hi, i'll see if I can reproduce it.
This problem is not straightforward for me, since I never used enums with typeorm...
To help, can you provide a:
- create enum + create table statements
- a typeorm entity with that enum that triggers this problem
in order to help me create a unit test ?
(or just a typeorm entity that will automatically create the right schema)
Thanks
Thank you @oguimbal I created this repo: https://github.com/suall1969/pg-mem-typeorm-enum-array-issue