From 7093239465252cc6c5914e74cc7fe3c0b6237cac Mon Sep 17 00:00:00 2001 From: pavel-zotov Date: Tue, 27 Jun 2023 13:32:38 +0300 Subject: [PATCH] Added/Updated tests\bugs\core_5337_test.py: Regression detected with 'UPDATE OR INSERT' statement (it was missed in original version of this test), added appropriate EXECUTE BLOCK. --- tests/bugs/core_5337_test.py | 56 +++++++++++++++++++++++++----------- 1 file changed, 40 insertions(+), 16 deletions(-) diff --git a/tests/bugs/core_5337_test.py b/tests/bugs/core_5337_test.py index c2aadb2c..a0751f69 100644 --- a/tests/bugs/core_5337_test.py +++ b/tests/bugs/core_5337_test.py @@ -3,11 +3,15 @@ """ ID: issue-5613 ISSUE: 5613 -TITLE: Regression: The subquery in the insert list expressions ignore the changes - made earlier in the same executable block. +TITLE: Regression: The subquery in the insert list expressions ignore the changes made earlier in the same executable block. DESCRIPTION: JIRA: CORE-5337 FBTEST: bugs.core_5337 +NOTES: + [27.06.2023] pzotov + Regression detected with 'UPDATE OR INSERT' statement (it was missed in original version of this test), added appropriate EXECUTE BLOCK. + Checked on 5.0.0.1088 (intermediate build after https://github.com/FirebirdSQL/firebird/commit/421a73ae4bd28dd935d1f668f43f9cc89bcf7fdd ) + Thanks to dimitr. """ import pytest @@ -16,34 +20,54 @@ from firebird.qa import * db = db_factory() test_script = """ + set list on; recreate table test ( - id integer not null, - val integer not null + id int primary key using index test_id + ,val int not null ); set term ^; - execute block - as + execute block as begin - insert into test (id, val) values (1, 100); - insert into test (id, val) values (2, (select val from test where id = 1)); + insert into test (id, val) values (1, 111); + insert into test (id, val) values (2, 2 * (select val from test where id = 1)); end ^ - set term ;^ - - set list on; - select * from test; - rollback; + select * from test ^ + rollback ^ + --------------------- + execute block as + begin + insert into test (id, val) values (3, 333); + end + ^ + execute block as + begin + update or insert into test( id + ,val + ) + values( 4 + ,3 * (select val from test where id = 3) + ) + matching(id); + end + ^ + select * from test ^ + rollback ^ """ act = isql_act('db', test_script) expected_stdout = """ ID 1 - VAL 100 - + VAL 111 ID 2 - VAL 100 + VAL 222 + + ID 3 + VAL 333 + ID 4 + VAL 999 """ @pytest.mark.version('>=3.0.1')