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

44 lines
1007 B
Python
Raw Permalink Normal View History

2021-04-26 20:07:00 +02:00
#coding:utf-8
2022-01-21 18:49:26 +01:00
"""
ID: issue-2480
ISSUE: 2480
TITLE: Incorrect result with UPDATE OR INSERT ... RETURNING OLD and non-nullable columns
DESCRIPTION:
JIRA: CORE-2044
FBTEST: bugs.core_2044
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 (
2021-04-26 20:07:00 +02:00
n integer primary key,
x1 integer not null,
x2 integer
);
"""
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 = """update or insert into t
2021-04-26 20:07:00 +02:00
values (1, 1, 1)
returning old.n, old.x1, old.x2, new.n, new.x1, new.x2;
"""
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
CONSTANT CONSTANT CONSTANT N X1 X2
============ ============ ============ ============ ============ ============
<null> <null> <null> 1 1 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