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_4330_test.py

67 lines
1.5 KiB
Python
Raw Normal View History

2021-04-26 20:07:00 +02:00
#coding:utf-8
2022-01-23 20:41:55 +01:00
"""
ID: issue-4653
ISSUE: 4653
TITLE: not correct result function LAG, if OFFSET value are assigned from a table
DESCRIPTION:
JIRA: CORE-4330
FBTEST: bugs.core_4330
2022-01-23 20:41:55 +01:00
"""
2021-04-26 20:07:00 +02:00
2022-01-23 20:41:55 +01:00
import pytest
from firebird.qa import *
2021-04-26 20:07:00 +02:00
2022-01-23 20:41:55 +01:00
db = db_factory()
2021-04-26 20:07:00 +02:00
2022-01-23 20:41:55 +01:00
test_script = """
2021-04-26 20:07:00 +02:00
set list on;
with t(a, b) as
(
select 1, null from rdb$database
union all
select 2, 1 from rdb$database
union all
select 3, 2 from rdb$database
union all
select 4, 3 from rdb$database
union all
select 5, 2 from rdb$database
)
select
a,
b,
lag(a, b)over(order by a) as la
from t ;
2021-12-22 20:23:11 +01:00
"""
2021-04-26 20:07:00 +02:00
2022-01-23 20:41:55 +01:00
act = isql_act('db', test_script)
2021-04-26 20:07:00 +02:00
2022-01-23 20:41:55 +01:00
expected_stdout = """
2021-04-26 20:07:00 +02:00
A 1
B <null>
LA <null>
A 2
B 1
LA 1
A 3
B 2
LA 1
A 4
B 3
LA 1
A 5
B 2
LA 3
2021-12-22 20:23:11 +01:00
"""
2021-04-26 20:07:00 +02:00
@pytest.mark.version('>=3.0')
2022-01-23 20:41:55 +01:00
def test_1(act: Action):
act.expected_stdout = expected_stdout
act.execute()
assert act.clean_stdout == act.clean_expected_stdout