Skip to content

Not working as expected #421

@DuncanNguyez

Description

@DuncanNguyez

Hi, I have another problem and I have some data for you. Is there a temporary fix?
Thank,

filter: (isDeleted : 'false' and (groups is empty or groups.name ! 'Hội đồng tín dụng'))
Not working as expected

Hibernate

select
e1_0.id,
e1_0.address_id,
e1_0.code,
e1_0.created_at,
e1_0.created_by,
e1_0.email,
e1_0.enabled,
e1_0.first_name,
e1_0.identity_info_id,
e1_0.is_deleted,
e1_0.last_modified_by,
e1_0.last_name,
e1_0.note,
e1_0.phone,
e1_0.updated_at,
e1_0.user_id,
e1_0.username
from
employee e1_0
where
exists(select
1
from
"group_employees" g1_0
join
"group" g1_1
on g1_1.id=g1_0."groups_id"
where
e1_0.is_deleted=false
and (not exists(select
1
from
"group_employees" g2_0
where
e1_0.id=g2_0.employees_id)
or g1_1.name<>'H?i ??ng tín d?ng')
and e1_0.id=g1_0.employees_id)
order by
e1_0.created_at desc
offset
? rows
fetch
first ? rows only

With the first condition ... where exists(select ... directly negates the inner condition ... (not exists(select...
It should be like this (chatGPT):

select
e1_0.id,
e1_0.address_id,
e1_0.code,
e1_0.created_at,
e1_0.created_by,
e1_0.email,
e1_0.enabled,
e1_0.first_name,
e1_0.identity_info_id,
e1_0.is_deleted,
e1_0.last_modified_by,
e1_0.last_name,
e1_0.note,
e1_0.phone,
e1_0.updated_at,
e1_0.user_id,
e1_0.username
from
employee e1_0
where
e1_0.is_deleted = false
and (
not exists(
select
1
from
"group_employees" g1_0
where
e1_0.id = g1_0.employees_id
)
or exists(
select
1
from
"group_employees" g1_0
join
"group" g1_1
on g1_1.id = g1_0."groups_id"
where
e1_0.id = g1_0.employees_id
and g1_1.name <> 'Hội đồng tín dụng'
)
)
order by
e1_0.created_at desc
offset
? rows
fetch
first ? rows only

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions