6
0
mirror of https://github.com/FirebirdSQL/firebird-qa.git synced 2025-01-23 14:03:06 +01:00
firebird-qa/tests/bugs/core_4917_test.py

92 lines
2.3 KiB
Python
Raw Normal View History

2021-04-26 20:07:00 +02:00
#coding:utf-8
2022-01-24 20:27:02 +01:00
"""
ID: issue-5209
ISSUE: 5209
TITLE: ALTER DOMAIN ... TO <new_name> allows to specify <new_name> matching to 'RDB$[[:DIGIT:]]*'
DESCRIPTION:
JIRA: CORE-4917
FBTEST: bugs.core_4917
2022-01-24 20:27:02 +01:00
"""
2021-04-26 20:07:00 +02:00
2022-01-24 20:27:02 +01:00
import pytest
from firebird.qa import *
2021-04-26 20:07:00 +02:00
2022-01-24 20:27:02 +01:00
db = db_factory()
2021-04-26 20:07:00 +02:00
2022-01-24 20:27:02 +01:00
test_script = """
2021-04-26 20:07:00 +02:00
-- CREATION:
-- #########
2022-01-24 20:27:02 +01:00
2021-04-26 20:07:00 +02:00
-- First, check that direct creation of domain with 'RDB$' prefix is disabled:
create domain rdb$1 int;
2022-01-24 20:27:02 +01:00
2021-04-26 20:07:00 +02:00
-- This also should FAIL becase new domain name is written in UPPER case (despite quotes):
create domain "RDB$2" int;
2022-01-24 20:27:02 +01:00
-- This should pass because new though name starts with 'rdb$' it
2021-04-26 20:07:00 +02:00
-- is written in quotes and not in upper case:
create domain "rdb$1" int;
2022-01-24 20:27:02 +01:00
2021-04-26 20:07:00 +02:00
-- ALTERING:
-- #########
2022-01-24 20:27:02 +01:00
2021-04-26 20:07:00 +02:00
alter domain "rdb$1" to foo;
2022-01-24 20:27:02 +01:00
2021-04-26 20:07:00 +02:00
alter domain foo to "rdb$1";
2022-01-24 20:27:02 +01:00
-- This should pass because new though name starts with 'rdb$' it
2021-04-26 20:07:00 +02:00
-- is written in quotes and not in upper case:
alter domain "rdb$1" to "rdb$2";
2022-01-24 20:27:02 +01:00
2021-04-26 20:07:00 +02:00
-- this should FAIL:
alter domain "rdb$2" to RDB$3;
2022-01-24 20:27:02 +01:00
2021-04-26 20:07:00 +02:00
-- this also should FAIL becase new domain name is written in UPPER case (despite quotes):
alter domain "rdb$2" to "RDB$3";
2022-01-24 20:27:02 +01:00
2021-04-26 20:07:00 +02:00
show domain;
2022-01-24 20:27:02 +01:00
2021-12-22 20:23:11 +01:00
"""
2021-04-26 20:07:00 +02:00
2022-01-24 20:27:02 +01:00
act = isql_act('db', test_script)
2021-04-26 20:07:00 +02:00
2022-01-24 20:27:02 +01:00
expected_stdout = """
2021-04-26 20:07:00 +02:00
rdb$2
2021-12-22 20:23:11 +01:00
"""
2022-01-24 20:27:02 +01:00
expected_stderr = """
2021-04-26 20:07:00 +02:00
Statement failed, SQLSTATE = 42000
unsuccessful metadata update
-CREATE DOMAIN RDB$1 failed
-SQL error code = -637
-Implicit domain name RDB$1 not allowed in user created domain
Statement failed, SQLSTATE = 42000
unsuccessful metadata update
-CREATE DOMAIN RDB$2 failed
-SQL error code = -637
-Implicit domain name RDB$2 not allowed in user created domain
Statement failed, SQLSTATE = 42000
unsuccessful metadata update
-ALTER DOMAIN rdb$2 failed
-SQL error code = -637
-Implicit domain name RDB$3 not allowed in user created domain
Statement failed, SQLSTATE = 42000
unsuccessful metadata update
-ALTER DOMAIN rdb$2 failed
-SQL error code = -637
-Implicit domain name RDB$3 not allowed in user created domain
2021-12-22 20:23:11 +01:00
"""
2021-04-26 20:07:00 +02:00
@pytest.mark.version('>=3.0')
2022-01-24 20:27:02 +01:00
def test_1(act: Action):
act.expected_stdout = expected_stdout
act.expected_stderr = expected_stderr
act.execute()
assert (act.clean_stderr == act.clean_expected_stderr and
act.clean_stdout == act.clean_expected_stdout)
2021-04-26 20:07:00 +02:00