Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PG: Parse enum arrays columns #327

Open
avaly opened this issue Jun 19, 2024 · 0 comments
Open

PG: Parse enum arrays columns #327

avaly opened this issue Jun 19, 2024 · 0 comments

Comments

@avaly
Copy link
Contributor

avaly commented Jun 19, 2024

Currently, only primitive array columns are parsed and returned with the expected type by @database/pg. Columns defined as an array of a custom enum type are returned as a string.

CREATE TYPE test_enum AS ENUM ('foo', 'bar', 'ham');

CREATE TABLE test_types (
  id UUID NOT NULL PRIMARY KEY DEFAULT gen_random_uuid(),
  scores INTEGER[],
  enums test_enum
);

INSERT INTO test_types (scores, enums) VALUES ('{1, 5, 10}', '{foo, bar}');

Running a simple SELECT via @databases/pg returns the following result:

[
   {
       id: 'af821378-5077-4624-8048-2a951399daec',
       scores: [ 1, 5, 10 ],
       enums: '{foo,bar}'
    }
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant