mirror of
https://github.com/FirebirdSQL/firebird-qa.git
synced 2025-01-23 22:13:05 +01:00
78 lines
1.6 KiB
Python
78 lines
1.6 KiB
Python
#coding:utf-8
|
|
|
|
"""
|
|
ID: issue-2066
|
|
ISSUE: 2066
|
|
TITLE: CREATE OR ALTER VIEW statement
|
|
DESCRIPTION:
|
|
JIRA: CORE-1640
|
|
FBTEST: bugs.core_1640
|
|
"""
|
|
|
|
import pytest
|
|
from firebird.qa import db_factory, isql_act, Action
|
|
|
|
init_script = """create table users (
|
|
id integer,
|
|
name varchar(20),
|
|
passwd varchar(20)
|
|
);
|
|
|
|
commit;"""
|
|
|
|
db = db_factory(init=init_script)
|
|
|
|
test_script = """create or alter view v_users as
|
|
select name from users;
|
|
commit;
|
|
show view v_users;
|
|
create or alter view v_users (id, name, passwd ) as
|
|
select id, name, passwd from users;
|
|
commit;
|
|
show view v_users;
|
|
create or alter view v_users_name as
|
|
select name from v_users;
|
|
commit;
|
|
create or alter view v_users (id, name ) as
|
|
select id, name from users;
|
|
commit;
|
|
show view v_users;
|
|
show view v_users_name;
|
|
|
|
|
|
"""
|
|
|
|
act = isql_act('db', test_script)
|
|
|
|
expected_stdout = """ NAME VARCHAR(20) Nullable
|
|
View Source:
|
|
==== ======
|
|
|
|
select name from users
|
|
ID INTEGER Nullable
|
|
NAME VARCHAR(20) Nullable
|
|
PASSWD VARCHAR(20) Nullable
|
|
View Source:
|
|
==== ======
|
|
|
|
select id, name, passwd from users
|
|
ID INTEGER Nullable
|
|
NAME VARCHAR(20) Nullable
|
|
View Source:
|
|
==== ======
|
|
|
|
select id, name from users
|
|
NAME VARCHAR(20) Nullable
|
|
View Source:
|
|
==== ======
|
|
|
|
select name from v_users
|
|
"""
|
|
|
|
@pytest.mark.version('>=3')
|
|
def test_1(act: Action):
|
|
act.expected_stdout = expected_stdout
|
|
act.execute()
|
|
assert act.clean_stdout == act.clean_expected_stdout
|
|
|