Invalid access of subselect columns in automatically generated subselect #5184

Closed
opened 2026-01-22 15:00:57 +01:00 by admin · 1 comment
Owner

Originally created by @apfelbox on GitHub (Jul 11, 2016).

Originally assigned to: @Ocramius on GitHub.

I see a lot of errors of the following pattern:

SELECT 
  DISTINCT blog_article_id_0 
FROM 
  (
    SELECT 
      ...
      b0_.date AS date_4, 
      ...
      b0_.like_count AS like_count_8, 
      ...
    FROM 
      blog_articles b0_
  ) dctrn_result 
ORDER BY 
  date_4 DESC, 
  like_count_8 DESC

The error is that the outer query tries to use fields from the inner query, which obviously fails.
These issues first appeared for 2.5 and only appear on certain occassions - but if they appear they are consistent, i.e. they are reproducible.

The current error case is quite big, I try to create a reduced reproducible test case.

Just wanted to create the issue beforehand, because maybe somebody had similar issues and knows of any solution?

Installed versions:

doctrine/annotations                 v1.2.7             Docblock Annotations Parser
doctrine/cache                       v1.6.0             Caching library offering an object-oriented API for many cache backends
doctrine/collections                 v1.3.0             Collections Abstraction library
doctrine/common                      v2.6.1             Common Library for Doctrine projects
doctrine/dbal                        v2.5.4             Database Abstraction Layer
doctrine/doctrine-bundle             1.6.3              Symfony DoctrineBundle
doctrine/doctrine-cache-bundle       1.3.0              Symfony Bundle for Doctrine Cache
doctrine/doctrine-migrations-bundle  1.1.1              Symfony DoctrineMigrationsBundle
doctrine/inflector                   v1.1.0             Common String Manipulations with regard to casing and singular/plural rules.
doctrine/instantiator                1.0.5              A small, lightweight utility to instantiate objects in PHP without invoking their constructors
doctrine/lexer                       v1.0.1             Base library for a lexer that can be used in Top-Down, Recursive Descent Parsers.
doctrine/migrations                  1.4.1              Database Schema migrations using Doctrine DBAL
doctrine/orm                         v2.5.4             Object-Relational-Mapper for PHP
Originally created by @apfelbox on GitHub (Jul 11, 2016). Originally assigned to: @Ocramius on GitHub. I see a lot of errors of the following pattern: ``` sql SELECT DISTINCT blog_article_id_0 FROM ( SELECT ... b0_.date AS date_4, ... b0_.like_count AS like_count_8, ... FROM blog_articles b0_ ) dctrn_result ORDER BY date_4 DESC, like_count_8 DESC ``` The error is that the outer query tries to use fields from the inner query, which obviously fails. These issues first appeared for 2.5 and only appear on certain occassions - but if they appear they are consistent, i.e. they are reproducible. The current error case is quite big, I try to create a reduced reproducible test case. Just wanted to create the issue beforehand, because maybe somebody had similar issues and knows of any solution? Installed versions: ``` doctrine/annotations v1.2.7 Docblock Annotations Parser doctrine/cache v1.6.0 Caching library offering an object-oriented API for many cache backends doctrine/collections v1.3.0 Collections Abstraction library doctrine/common v2.6.1 Common Library for Doctrine projects doctrine/dbal v2.5.4 Database Abstraction Layer doctrine/doctrine-bundle 1.6.3 Symfony DoctrineBundle doctrine/doctrine-cache-bundle 1.3.0 Symfony Bundle for Doctrine Cache doctrine/doctrine-migrations-bundle 1.1.1 Symfony DoctrineMigrationsBundle doctrine/inflector v1.1.0 Common String Manipulations with regard to casing and singular/plural rules. doctrine/instantiator 1.0.5 A small, lightweight utility to instantiate objects in PHP without invoking their constructors doctrine/lexer v1.0.1 Base library for a lexer that can be used in Top-Down, Recursive Descent Parsers. doctrine/migrations 1.4.1 Database Schema migrations using Doctrine DBAL doctrine/orm v2.5.4 Object-Relational-Mapper for PHP ```
admin added the BugDuplicate labels 2026-01-22 15:00:57 +01:00
admin closed this issue 2026-01-22 15:00:57 +01:00
Author
Owner

@apfelbox commented on GitHub (Jul 11, 2016):

Seems to be a duplicate of #5622, sorry for the noise.

@apfelbox commented on GitHub (Jul 11, 2016): Seems to be a duplicate of #5622, sorry for the noise.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#5184