supabase / pg_graphql

GraphQL support for PostgreSQL
https://supabase.github.io/pg_graphql
Apache License 2.0
2.82k stars 96 forks source link

Filtering Arrays of Enums #530

Open leefordjudes opened 1 month ago

leefordjudes commented 1 month ago

Describe the bug

523 pg_graphql 1.5.5 - array with enum type - not working

the above issue & its fixes - fix graphql schema generation issue, and arrayfilter operators.

Now i can use array filter with text[], int[], but i can not filter enum[]. kindly add enum support for array filter.

To Reproduce Steps to reproduce the behavior:

create type typ_base_account_type as enum (
    'DIRECT_INCOME', 'INDIRECT_INCOME', .. . . . 
    );
create table if not exists account_type
(
    id             int       not null generated by default as identity primary key,
    name           text      not null,
    base_types    typ_base_account_type[] not null,
   -- base_types     text[]    not null,
. . .
);

now insert some records

Expected behavior Add array filter support for array with enum

Screenshots ArrayFilter with enum array shows error: Screenshot 2024-06-12 150424

List enum array works well Screenshot 2024-06-12 150345

List & ArrayFilter with string, int - works well

Screenshot 2024-06-12 150206

Screenshot 2024-06-12 150250

Versions:

martmull commented 1 month ago

Same issue, I would love to have filters support enums

olirice commented 1 month ago

The complexity comes from Enum's support for remapping variants which will require work in the transpiler to make it fully functional

Its not a blocked, but it'll require a bit more work than the other primitive scalar types