Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Server crash when preparing a query with PLAN clause at some CTE [CORE4867] #5163

Closed
firebird-issue-importer opened this issue Jul 9, 2015 · 5 comments

Comments

@firebird-issue-importer
Copy link

Submitted by: @hvlad

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

Commits: 5e296cb FirebirdSQL/fbt-repository@7c68250

@firebird-issue-importer
Copy link
Author

Modified by: @dyemanov

assignee: Dmitry Yemanov [ dimitr ]

@firebird-issue-importer
Copy link
Author

Modified by: @dyemanov

Version: 2.5.3 Update 1 [ 10650 ]

Version: 2.1.7 [ 10651 ]

Version: 2.5.3 [ 10461 ]

Version: 2.1.6 [ 10460 ]

Version: 2.5.2 Update 1 [ 10521 ]

Version: 2.1.5 Update 1 [ 10522 ]

Version: 2.5.2 [ 10450 ]

Version: 2.5.1 [ 10333 ]

Version: 2.5.0 [ 10221 ]

Fix Version: 2.5.5 [ 10670 ]

@firebird-issue-importer
Copy link
Author

Modified by: @dyemanov

status: Open [ 1 ] => Resolved [ 5 ]

resolution: Fixed [ 1 ]

@firebird-issue-importer
Copy link
Author

Modified by: @pavel-zotov

status: Resolved [ 5 ] => Resolved [ 5 ]

QA Status: No test => Done successfully

@firebird-issue-importer
Copy link
Author

Modified by: @pavel-zotov

status: Resolved [ 5 ] => Closed [ 6 ]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment