Skip to content

Showcases the issue with enum arrays in pg-mem when using Typeorm

Notifications You must be signed in to change notification settings

Suall1969/pg-mem-typeorm-enum-array-issue

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

What is this?

This is a very minimal reproduction code for the issue with enum arrays in pg-mem that occurs with Typeorm.

How to run it?

  1. clone repository
  2. run npm i
  3. run npm start

Why the issue occurs?

Enum arrays, like other arrays, are serialised as strings {value1, value2} and pg-mem parses these strings into actual arrays ['value1', 'value2']. The problem is that the ubiquitous Postgres driver namely node-postgres doesn't parse enum arrays by default (although it can be configured to do so). Thus, Typeorm always tries to parse enum arrays manually; which fails with pg-mem since they are already parsed beforehand.

What can be done about this?

At the very least, there should be an option to disable parsing of specified emums or enum arrays in general. Ideally the parsing corpus can be extracted into separate abstractions and be pluged-in as needed, similar to node-postgres.

About

Showcases the issue with enum arrays in pg-mem when using Typeorm

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published