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

fix(postgres): Support enum array #13592

Closed
wants to merge 6 commits into from
Closed

fix(postgres): Support enum array #13592

wants to merge 6 commits into from

Conversation

codemers
Copy link

@codemers codemers commented Oct 25, 2021

Pull Request check-list

Please make sure to review and check all of these items:

  • Does npm run test or npm run test-DIALECT pass with this change (including linting)?
  • Does the description below contain a link to an existing issue (Closes #[issue]) or a description of the issue you are solving?
  • Have you added new tests to prevent regressions?
  • Did you follow the commit message conventions explained in CONTRIBUTING.md?

Description of change

Currently when dealing with an array of enum using the Postgres dialect, Sequelize generates an invalid enumeration cast key while inserting data.

Related issue (I think): #4048

DDL of the table:

create table "Table"
(
    id uuid not null constraint "Table_pkey" primary key,
    "createdAt"      timestamp with time zone         not null,
    "updatedAt"      timestamp with time zone         not null,
    "deletedAt"      timestamp with time zone,
    column           "enum_Table_column"[] not null
);

DDL of the type

create type "enum_Table_column" as enum ('Value1', 'Value2', 'Value3');

Then while inserting data here's the cast key generated by sequelize:

array['Value1']::"enum_public.Table_Column"[]

The correct cast key should be:

array['Value1']::"enum_Table_Column"[]

This pr fixes this issue.

@codemers codemers marked this pull request as ready for review October 25, 2021 20:35
@github-actions github-actions bot added the stale label Nov 20, 2021
@sdepold
Copy link
Member

sdepold commented Dec 3, 2021

@codemers Can you look into the tests and rebase your branch?

@sdepold sdepold self-assigned this Dec 3, 2021
@sdepold sdepold added status: awaiting response For issues and PRs. OP must respond (or change something, if it is a PR). Maintainers have no action and removed stale labels Dec 3, 2021
@github-actions github-actions bot added the stale label Dec 18, 2021
@sdepold
Copy link
Member

sdepold commented Dec 22, 2021

Is this by any chance the same as #13807 ?

@sdepold
Copy link
Member

sdepold commented Dec 22, 2021

cc @nahog

@nahog
Copy link
Contributor

nahog commented Dec 22, 2021

Yes, this is the same issue, but the PR here only works for public as is not passing the schema if its redefined, the #13807 fix handle both scenarios, when is using the public/empty schema, that both:
"enum_my_enum"[] and "public"."enum_my_enum"[] works
and the scenario where schemas are needed like:
"my_schema"."enum_my_enum"[]

@codemers try the current main branch (merged today) code to confirm the issue is fixed for you, but I think it is.

@github-actions github-actions bot removed the status: awaiting response For issues and PRs. OP must respond (or change something, if it is a PR). Maintainers have no action label Dec 22, 2021
@nahog
Copy link
Contributor

nahog commented Dec 22, 2021

@codemers 6.12.2 was just released with a fix for this issue. Please try that version and if it works this bug can be probably closed.

@github-actions github-actions bot removed the stale label Dec 23, 2021
@sdepold sdepold closed this Jan 1, 2022
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

Successfully merging this pull request may close these issues.

None yet

5 participants