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

53 lines
964 B
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-2691
ISSUE: 2691
TITLE: Grouping by function doesn't work properly
DESCRIPTION:
JIRA: CORE-2265
FBTEST: bugs.core_2265
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 t (col1 date, col2 int);
2021-04-26 20:07:00 +02:00
commit;
insert into t values ('2011-01-01', 1);
commit;
"""
2022-01-21 18:49:26 +01:00
db = db_factory(init=init_script)
2021-04-26 20:07:00 +02:00
2022-01-21 18:49:26 +01:00
test_script = """select extract(year from col1), sum(col2)
2021-04-26 20:07:00 +02:00
from t
group by extract(year from col1);
select extract(year from col1), sum(col2)
from t
group by 1;
"""
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
EXTRACT SUM
======= =====================
2011 1
EXTRACT SUM
======= =====================
2011 1
"""
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