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

56 lines
1.2 KiB
Python
Raw Normal View History

2021-04-26 20:07:00 +02:00
#coding:utf-8
2022-01-26 21:10:46 +01:00
"""
ID: issue-6007
ISSUE: 6007
TITLE: Conversion error when both GROUP/ORDER BY expressions and WHERE expressions contain literals
DESCRIPTION:
Minimal requirements for reproduce:
1) boolean field with reference in WHERE clause;
2) indexed integer field.
JIRA: CORE-5743
FBTEST: bugs.core_5743
2022-01-26 21:10:46 +01:00
"""
2021-04-26 20:07:00 +02:00
2022-01-26 21:10:46 +01:00
import pytest
from firebird.qa import *
2021-04-26 20:07:00 +02:00
2022-01-26 21:10:46 +01:00
db = db_factory()
2021-04-26 20:07:00 +02:00
2022-01-26 21:10:46 +01:00
test_script = """
2021-04-26 20:07:00 +02:00
create table journal_caisse (
annule boolean
,periode int
2022-01-26 21:10:46 +01:00
);
2021-04-26 20:07:00 +02:00
create index journal_caisse_idx on journal_caisse (periode);
set planonly;
select 1 as type_mvt
from journal_caisse
2022-01-26 21:10:46 +01:00
where
2021-04-26 20:07:00 +02:00
annule is false
2022-01-26 21:10:46 +01:00
and
2021-04-26 20:07:00 +02:00
(periode = ?)
group by 1
;
-- sample from CORE-5749:
select 'my constant ' as dsc, count( * )
from rdb$relations a
where a.rdb$system_flag = 99
group by 1
;
2021-12-22 20:23:11 +01:00
"""
2021-04-26 20:07:00 +02:00
2022-01-26 21:10:46 +01:00
act = isql_act('db', test_script)
2021-04-26 20:07:00 +02:00
2022-01-26 21:10:46 +01:00
expected_stdout = """
2021-04-26 20:07:00 +02:00
PLAN SORT (JOURNAL_CAISSE INDEX (JOURNAL_CAISSE_IDX))
PLAN SORT (A NATURAL)
2021-12-22 20:23:11 +01:00
"""
2021-04-26 20:07:00 +02:00
@pytest.mark.version('>=3.0.4')
2022-01-26 21:10:46 +01:00
def test_1(act: Action):
act.expected_stdout = expected_stdout
act.execute()
assert act.clean_stdout == act.clean_expected_stdout