6
0
mirror of https://github.com/FirebirdSQL/firebird-qa.git synced 2025-01-23 05:53:06 +01:00
firebird-qa/tests/bugs/core_2910_test.py

53 lines
1.0 KiB
Python
Raw Normal View History

2021-04-26 20:07:00 +02:00
#coding:utf-8
2022-01-21 18:49:26 +01:00
"""
ID: issue-3294
ISSUE: 3294
TITLE: PK index is not used for derived tables
DESCRIPTION:
JIRA: CORE-2910
FBTEST: bugs.core_2910
2022-01-21 18:49:26 +01:00
"""
2021-04-26 20:07:00 +02:00
2022-01-21 18:49:26 +01:00
import pytest
from firebird.qa import *
2021-04-26 20:07:00 +02:00
2022-01-21 18:49:26 +01:00
init_script = """CREATE TABLE R$TMP (
2021-04-26 20:07:00 +02:00
POSTING_ID INTEGER
);
CREATE TABLE TMP (
POSTING_ID INTEGER NOT NULL
);
ALTER TABLE TMP ADD CONSTRAINT PK_TMP PRIMARY KEY (POSTING_ID);
commit;
"""
2022-01-21 18:49:26 +01:00
db = db_factory(charset='UTF8', init=init_script)
2021-04-26 20:07:00 +02:00
2022-01-21 18:49:26 +01:00
test_script = """SET PLAN ON;
2021-04-26 20:07:00 +02:00
select r.POSTING_ID as r$POSTING_ID, t.POSTING_ID from (
SELECT POSTING_ID
FROM r$tmp
) r left join (
select POSTING_ID from
(select
posting_id
from tmp)
) t on r.POSTING_ID = t.POSTING_ID;
"""
2022-01-21 18:49:26 +01:00
act = isql_act('db', test_script)
2021-04-26 20:07:00 +02:00
2022-01-21 18:49:26 +01:00
expected_stdout = """
2021-04-26 20:07:00 +02:00
PLAN JOIN (R R$TMP NATURAL, T TMP INDEX (PK_TMP))
"""
2022-01-21 18:49:26 +01:00
@pytest.mark.version('>=3.0')
def test_1(act: Action):
act.expected_stdout = expected_stdout
act.execute()
assert act.clean_stdout == act.clean_expected_stdout
2021-04-26 20:07:00 +02:00