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

57 lines
1.5 KiB
Python
Raw Permalink Normal View History

2021-04-26 20:07:00 +02:00
#coding:utf-8
2022-01-26 21:10:46 +01:00
"""
ID: issue-6133
ISSUE: 6133
TITLE: Provide name of read-only column incorrectly referenced in UPDATE ... SET xxx
DESCRIPTION:
Table with computed field (non-ascii) that is result of addition is used here.
UPDATE statement is used in trivial form, then as 'update or insert' and as 'merge'.
All cases should produce STDERR with specifying table name and R/O column after dot.
JIRA: CORE-5874
FBTEST: bugs.core_5874
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(charset='UTF8')
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
recreate table test(id int, x int, y int, "hozzáadása" computed by (x * y) );
commit;
set planonly;
update test set "hozzáadása" = 1;
2022-01-26 21:10:46 +01:00
update or insert into test(id, "hozzáadása")
2021-04-26 20:07:00 +02:00
values(1, 111) matching(id)
returning "hozzáadása";
merge into test t
using( select 1 as id, 2 as x, 3 as y from rdb$database ) s on s.id = t.id
2022-01-26 21:10:46 +01:00
when matched then
2021-04-26 20:07:00 +02:00
update set "hozzáadása" = 1
2022-01-26 21:10:46 +01:00
;
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_stderr = """
2021-04-26 20:07:00 +02:00
Statement failed, SQLSTATE = 42000
attempted update of read-only column TEST.hozzáadása
Statement failed, SQLSTATE = 42000
attempted update of read-only column TEST.hozzáadása
Statement failed, SQLSTATE = 42000
attempted update of read-only column TEST.hozzáadása
2021-12-22 20:23:11 +01:00
"""
2021-04-26 20:07:00 +02:00
@pytest.mark.version('>=4.0')
2022-01-26 21:10:46 +01:00
def test_1(act: Action):
act.expected_stderr = expected_stderr
act.execute()
assert act.clean_stderr == act.clean_expected_stderr