6
0
mirror of https://github.com/FirebirdSQL/firebird-qa.git synced 2025-01-22 13:33:07 +01:00
firebird-qa/tests/bugs/core_4622_test.py

68 lines
1.5 KiB
Python
Raw Permalink Normal View History

2021-04-26 20:07:00 +02:00
#coding:utf-8
2022-01-24 20:27:02 +01:00
"""
ID: issue-4937
ISSUE: 4937
TITLE: Regression: Trigger with UPDATE OR INSERT statement and IIF() not working as expected
DESCRIPTION:
JIRA: CORE-4622
FBTEST: bugs.core_4622
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
set term ^;
execute block as
begin
execute statement 'drop trigger v_test_bu';
when any do begin end
end
^
set term ;^
commit;
2022-01-24 20:27:02 +01:00
2021-04-26 20:07:00 +02:00
create or alter view v_test as select 1 id from rdb$database;
commit;
-------------------------------------------------------------
recreate table test (
id integer not null,
a integer,
b integer,
constraint pk_test primary key (id)
);
commit;
insert into test values(1, 100, 200);
commit;
2022-01-24 20:27:02 +01:00
2021-04-26 20:07:00 +02:00
create or alter view v_test as
select id, a, b from test;
commit;
2022-01-24 20:27:02 +01:00
2021-04-26 20:07:00 +02:00
set term ^;
create or alter trigger v_test_bu for v_test
active before update position 0
as
begin
-- Confirmed on WI-T3.0.0.31374 Firebird 3.0 Beta 1:
-- Statement failed, SQLSTATE = HY000
-- invalid request BLR at offset 51
-- -undefined variable number
update or insert into test ( id , a , b)
values ( iif( mod( new.id,2)=0, -new.id, new.id ), new.a, new.b)
matching( id );
end
^
set term ;^
commit;
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
@pytest.mark.version('>=3')
def test_1(act: Action):
2022-01-25 22:55:48 +01:00
act.execute()