DDC-1696: String support in THEN and ELSE part of CASE expression is broken #2136

Closed
opened 2026-01-22 13:42:22 +01:00 by admin · 2 comments
Owner

Originally created by @doctrinebot on GitHub (Mar 11, 2012).

Originally assigned to: @guilhermeblanco on GitHub.

Jira issue originally created by user @asm89:

The SQL generated when using strings in the THEN and ELSE parts of the CASE expression are not valid.

This testcase will fail:
$this->assertSqlGeneration(
"SELECT g.id, CASE WHEN ((g.id / 2) > 18) THEN 'Foo' ELSE 'Bar' END AS test FROM Doctrine\Tests\Models\CMS\CmsGroup g",
"SELECT c0_.id AS id0, CASE WHEN (c0_.id / 2 > 18) THEN 'Foo' ELSE 'Bar' END AS sclr1 FROM cms_groups c0_"
);

Noticed by a user at github:
https://github.com/doctrine/doctrine2/pull/277
https://github.com/doctrine/doctrine2/pull/278

Originally created by @doctrinebot on GitHub (Mar 11, 2012). Originally assigned to: @guilhermeblanco on GitHub. Jira issue originally created by user @asm89: The SQL generated when using strings in the THEN and ELSE parts of the CASE expression are not valid. This testcase will fail: $this->assertSqlGeneration( "SELECT g.id, CASE WHEN ((g.id / 2) > 18) THEN 'Foo' ELSE 'Bar' END AS test FROM Doctrine\Tests\Models\CMS\CmsGroup g", "SELECT c0_.id AS id0, CASE WHEN (c0_.id / 2 > 18) THEN 'Foo' ELSE 'Bar' END AS sclr1 FROM cms_groups c0_" ); Noticed by a user at github: https://github.com/doctrine/doctrine2/pull/277 https://github.com/doctrine/doctrine2/pull/278
admin added the Bug label 2026-01-22 13:42:22 +01:00
admin closed this issue 2026-01-22 13:42:22 +01:00
Author
Owner

@doctrinebot commented on GitHub (Mar 12, 2012):

Comment created by @guilhermeblanco:

Fixed by 7954386705

@beberlei please merge in 2.2! =D

@doctrinebot commented on GitHub (Mar 12, 2012): Comment created by @guilhermeblanco: Fixed by https://github.com/doctrine/doctrine2/commit/795438670517cd7a4e76bca6dd33fdc9bbb5d988 @beberlei please merge in 2.2! =D
Author
Owner

@doctrinebot commented on GitHub (Mar 12, 2012):

Issue was closed with resolution "Fixed"

@doctrinebot commented on GitHub (Mar 12, 2012): Issue was closed with resolution "Fixed"
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#2136