mirror of
https://github.com/doctrine/orm.git
synced 2026-03-24 06:52:09 +01:00
Discriminator column empty value "IN" query #7186
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @Legion112 on GitHub (Jul 17, 2023).
Bug Report
Summary
DiscriminatorMap adding empty value (
'') to SQL query example:This leads to error
invalid input valuewhen using Enum for Postgres DBCurrent behavior
Adding
o0_.type IN ('blockchain-in', 'expense', '')is incorrect and should beo0_.type IN ('blockchain-in', 'expense')How to reproduce
I create a repository with an easy way to reproduce this issue.
It was introduced in version
2.14.2prior to this version it was working as expected.You could verify it by cloning the repository: https://github.com/Legion112/doctrine-playground
After cloning use docker for quick setup:
After running the command below in logs you could see a wrong select statement
I have confirmed that this version correctly was formatted correctly
Expected behavior
@JanTvrdik commented on GitHub (Sep 15, 2023):
This error comes from
Doctrine\ORM\Query\SqlWalker::generateDiscriminatorColumnConditionSQL(), because thediscriminatorValueof a intermediate subclass will be null.It is most likely caused by https://github.com/doctrine/orm/pull/10411.
Similar issue already fixed: https://github.com/doctrine/orm/pull/10643
It also emits to following error:
@mpdude commented on GitHub (Feb 2, 2024):
Please report in #11200 whether it fixes this issue
@Legion112 commented on GitHub (Feb 2, 2024):
I have installed the patched on my tested project


I have tested it on my playground and I confirm that the patch will fix the issue with IN statement.
Some testing on real application could be done by my colleague @RalkeryBug
To test you would need to add fork repository:
Install the patch version
Run the application test to make sure patch does not break anything else.
@mpdude commented on GitHub (Feb 3, 2024):
Fixed by #11200