6
0
mirror of https://github.com/FirebirdSQL/firebird-qa.git synced 2025-01-22 21:43:06 +01:00
firebird-qa/tests/bugs/core_4694_test.py

58 lines
1.1 KiB
Python
Raw Normal View History

2021-04-26 20:07:00 +02:00
#coding:utf-8
2022-01-24 20:27:02 +01:00
"""
ID: issue-5002
ISSUE: 5002
TITLE: "Column unknown" error while preparing a recursive query if the recursive part
contains ALIASED datasource in the join with anchor table
2022-01-24 20:27:02 +01:00
DESCRIPTION:
JIRA: CORE-4694
FBTEST: bugs.core_4694
2022-01-24 20:27:02 +01:00
"""
2021-04-26 20:07:00 +02:00
2022-01-24 20:27:02 +01:00
import pytest
from firebird.qa import *
2021-04-26 20:07:00 +02:00
2022-01-24 20:27:02 +01:00
db = db_factory()
2021-04-26 20:07:00 +02:00
2022-01-24 20:27:02 +01:00
test_script = """
2021-04-26 20:07:00 +02:00
recreate table xcall_stack (
xcall_id int
,xcaller_id int
);
commit;
2022-01-24 20:27:02 +01:00
2021-04-26 20:07:00 +02:00
set planonly;
2022-01-24 20:27:02 +01:00
2021-04-26 20:07:00 +02:00
with recursive
r as (
select c.xcall_id
from xcall_stack c
where c.xcaller_id is null
2022-01-24 20:27:02 +01:00
2021-04-26 20:07:00 +02:00
UNION ALL
2022-01-24 20:27:02 +01:00
2021-04-26 20:07:00 +02:00
select
c.xcall_id
from xcall_stack c
join r
AS h -- <<<<<<<<<<<<<<<<<<<<<< ::: NB ::: `r` is aliased
on c.xcaller_id = h.xcall_id
)
select r.xcall_id
from r;
2021-12-22 20:23:11 +01:00
"""
2021-04-26 20:07:00 +02:00
2022-01-24 20:27:02 +01:00
act = isql_act('db', test_script)
2021-04-26 20:07:00 +02:00
2022-01-24 20:27:02 +01:00
expected_stdout = """
2021-04-26 20:07:00 +02:00
PLAN (R C NATURAL, R C NATURAL)
2021-12-22 20:23:11 +01:00
"""
2021-04-26 20:07:00 +02:00
@pytest.mark.version('>=3.0')
2022-01-24 20:27:02 +01:00
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