Server crash when preparing a query with PLAN clause at some CTE
----------------------------------------------------------------

                 Key: CORE-4867
                 URL: http://tracker.firebirdsql.org/browse/CORE-4867
             Project: Firebird Core
          Issue Type: Bug
          Components: Engine
    Affects Versions: 2.5.4
            Reporter: Vlad Khorsun


1. Prepare metatada:

CREATE TABLE TABLE1 (
  FIELD1 INTEGER NOT NULL
);
ALTER TABLE TABLE1 ADD CONSTRAINT PK_TABLE1 PRIMARY KEY (FIELD1);

CREATE TABLE TABLE2 (
  FIELD1 INTEGER NOT NULL,
  DATE1 DATE NOT NULL
);
ALTER TABLE TABLE2 ADD CONSTRAINT PK_TABLE2 PRIMARY KEY (FIELD1, DATE1)
  USING DESCENDING INDEX PK_TABLE2;
CREATE INDEX IDX_TABLE2 ON TABLE2 (FIELD1, DATE1);
COMMIT;


2. Problem query:
WITH AA
AS (SELECT T1.FIELD1,
           (SELECT FIRST 1 T2.DATE1
              FROM TABLE2 T2
             WHERE T2.FIELD1 = T1.FIELD1
            PLAN(T2 INDEX(IDX_TABLE2))
            ORDER BY T2.FIELD1 ASC, T2.DATE1 ASC) AS DATE1
      FROM TABLE1 T1)

SELECT DATE1, COUNT('x')
  FROM AA
GROUP BY 1   

Note, if PLAN clause commented out, Firebird will not crash

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://tracker.firebirdsql.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

------------------------------------------------------------------------------
Don't Limit Your Business. Reach for the Cloud.
GigeNET's Cloud Solutions provide you with the tools and support that
you need to offload your IT needs and focus on growing your business.
Configured For All Businesses. Start Your Cloud Today.
https://www.gigenetcloud.com/
Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel

Reply via email to