2021-04-26 20:07:00 +02:00
|
|
|
#coding:utf-8
|
|
|
|
|
2022-01-22 21:59:15 +01:00
|
|
|
"""
|
|
|
|
ID: issue-3887
|
|
|
|
ISSUE: 3887
|
|
|
|
TITLE: BETWEEN operand/clause not supported for COMPUTED columns -- "feature is not supported"
|
|
|
|
DESCRIPTION:
|
|
|
|
JIRA: CORE-3530
|
2022-02-02 15:46:19 +01:00
|
|
|
FBTEST: bugs.core_3530
|
2022-01-22 21:59:15 +01:00
|
|
|
"""
|
2021-04-26 20:07:00 +02:00
|
|
|
|
2022-01-22 21:59:15 +01:00
|
|
|
import pytest
|
|
|
|
from firebird.qa import *
|
2021-04-26 20:07:00 +02:00
|
|
|
|
2022-01-22 21:59:15 +01:00
|
|
|
db = db_factory()
|
2021-04-26 20:07:00 +02:00
|
|
|
|
2022-01-22 21:59:15 +01:00
|
|
|
test_script = """
|
2021-04-26 20:07:00 +02:00
|
|
|
recreate table test2(id int);
|
|
|
|
commit;
|
|
|
|
|
|
|
|
recreate table test(
|
|
|
|
x int,
|
2022-01-22 21:59:15 +01:00
|
|
|
y int
|
2021-04-26 20:07:00 +02:00
|
|
|
);
|
|
|
|
|
|
|
|
recreate table test2(
|
|
|
|
id int,
|
2022-01-22 21:59:15 +01:00
|
|
|
z computed by
|
2021-04-26 20:07:00 +02:00
|
|
|
(
|
2022-01-22 21:59:15 +01:00
|
|
|
coalesce( ( select sum(
|
|
|
|
case
|
|
|
|
when (x = -1) then
|
|
|
|
999
|
|
|
|
else
|
|
|
|
(coalesce(x, 0) - coalesce(y, 0))
|
|
|
|
end
|
|
|
|
)
|
2021-04-26 20:07:00 +02:00
|
|
|
from test
|
|
|
|
where x = test2.id
|
2022-01-22 21:59:15 +01:00
|
|
|
),
|
2021-04-26 20:07:00 +02:00
|
|
|
0
|
|
|
|
)
|
|
|
|
)
|
|
|
|
);
|
|
|
|
commit;
|
|
|
|
|
|
|
|
set plan on;
|
|
|
|
set count on;
|
|
|
|
--set echo on;
|
|
|
|
-- Before 3.0.2 following statement failed with:
|
|
|
|
-- Statement failed, SQLSTATE = 0A000
|
|
|
|
-- feature is not supported
|
|
|
|
select * from test2 where z between 1 and 2;
|
2021-12-22 20:23:11 +01:00
|
|
|
"""
|
2021-04-26 20:07:00 +02:00
|
|
|
|
2022-01-22 21:59:15 +01:00
|
|
|
act = isql_act('db', test_script)
|
2021-04-26 20:07:00 +02:00
|
|
|
|
2022-01-22 21:59:15 +01:00
|
|
|
expected_stdout = """
|
2021-04-26 20:07:00 +02:00
|
|
|
PLAN (TEST NATURAL)
|
|
|
|
PLAN (TEST NATURAL)
|
|
|
|
PLAN (TEST NATURAL)
|
|
|
|
PLAN (TEST2 NATURAL)
|
|
|
|
Records affected: 0
|
2021-12-22 20:23:11 +01:00
|
|
|
"""
|
2021-04-26 20:07:00 +02:00
|
|
|
|
|
|
|
@pytest.mark.version('>=3.0.2')
|
2022-01-22 21:59:15 +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
|
|
|
|