2021-04-26 20:07:00 +02:00
|
|
|
#coding:utf-8
|
|
|
|
|
2022-01-22 21:59:15 +01:00
|
|
|
"""
|
|
|
|
ID: issue-3405
|
|
|
|
ISSUE: 3405
|
|
|
|
TITLE: Error "no current record for fetch operation" after ALTER VIEW
|
|
|
|
DESCRIPTION:
|
|
|
|
JIRA: CORE-3024
|
2022-02-02 15:46:19 +01:00
|
|
|
FBTEST: bugs.core_3024
|
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-11-16 19:44:53 +01:00
|
|
|
|
2022-01-22 21:59:15 +01:00
|
|
|
act = python_act('db', substitutions=[('-', '')])
|
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
|
|
|
A B C
|
|
|
|
1 2 3
|
2021-11-16 19:44:53 +01:00
|
|
|
"""
|
2021-04-26 20:07:00 +02:00
|
|
|
|
2022-01-22 21:59:15 +01:00
|
|
|
@pytest.mark.version('>=3')
|
|
|
|
def test_1(act: Action, capsys):
|
|
|
|
with act.db.connect() as att1, act.db.connect() as att2:
|
2021-11-16 19:44:53 +01:00
|
|
|
trn1 = att1.transaction_manager()
|
|
|
|
cur1 = trn1.cursor()
|
|
|
|
cur1.execute("create table t(a int, b int, c int)") # att_12, tra_4
|
|
|
|
cur1.execute("create view v as select a,b from t")
|
|
|
|
trn1.commit()
|
|
|
|
cur1.execute("insert into t values(1,2,3)") # att_12, tra_5
|
|
|
|
cur1.execute("select * from v")
|
|
|
|
trn1.commit()
|
|
|
|
trn2 = att2.transaction_manager()
|
|
|
|
cur2 = trn2.cursor()
|
|
|
|
cur2.execute("select * from v") # att_13, tra_7
|
|
|
|
trn2.commit()
|
|
|
|
cur1.execute("alter view v as select a, b, c from t") # att-12, tra_8
|
|
|
|
trn1.commit()
|
|
|
|
cur2.execute("select * from v") # att_13, tra_9
|
2022-01-22 21:59:15 +01:00
|
|
|
act.print_data(cur2)
|
|
|
|
act.expected_stdout = expected_stdout
|
|
|
|
act.stdout = capsys.readouterr().out
|
|
|
|
assert act.clean_stdout == act.clean_expected_stdout
|