Issue Details (XML | Word | Printable)

Key: CORE-2783
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: Vlad Khorsun
Reporter: Vlad Khorsun
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
Firebird Core

AV using recursive query as subquery in SELECT list and ORDER'ing by them

Created: 02/Dec/09 03:44 AM   Updated: 03/May/11 12:08 PM
Component/s: Engine
Affects Version/s: 2.1.0, 2.5 Alpha 1, 2.1.1, 2.1.2, 2.5 Beta 1, 2.1.3, 2.5 RC1
Fix Version/s: 2.5 RC2, 2.1.4, 3.0 Alpha 1

Time Tracking:
Not Specified

Issue Links:
Relate
 

Planning Status: Unspecified


 Description  « Hide
This query make AV in engine

SELECT RDB$RELATION_ID,
       (WITH RECURSIVE
         NUM (ID) AS
         (
           SELECT 1 FROM RDB$DATABASE

           UNION ALL

           SELECT ID + 1
             FROM NUM
            WHERE ID < 10
         )
        SELECT MAX(ID) FROM NUM
       ) AS NNN
  FROM RDB$DATABASE
ORDER BY NNN


There is workaround. This query is equal and works ok :

WITH RECURSIVE
  NUM (ID) AS
  (
           SELECT 1 FROM RDB$DATABASE

           UNION ALL

           SELECT ID + 1
             FROM NUM
            WHERE ID < 10
  )
SELECT RDB$RELATION_ID, (SELECT MAX(ID) FROM NUM) AS NNN
  FROM RDB$DATABASE
ORDER BY NNN


 All   Comments   Work Log   Change History   Version Control   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Vlad Khorsun added a comment - 03/Dec/09 02:57 AM - edited
test mail #2

Philippe Makowski added a comment - 03/May/11 12:08 PM
Q/A test made