mirror of
https://github.com/FirebirdSQL/firebird-qa.git
synced 2025-01-22 13:33:07 +01:00
New metadata + cleanup
This commit is contained in:
parent
8e1956d242
commit
70bbf092ee
@ -1,22 +1,17 @@
|
||||
#coding:utf-8
|
||||
#
|
||||
# id: bugs.core_1306
|
||||
# title: Indices not used for views
|
||||
# decription:
|
||||
# tracker_id: CORE-1306
|
||||
# min_versions: []
|
||||
# versions: 3.0
|
||||
# qmid: bugs.core_1306
|
||||
|
||||
"""
|
||||
ID: issue-1726
|
||||
ISSUE: 1726
|
||||
TITLE: Indices not used for views
|
||||
DESCRIPTION:
|
||||
JIRA: CORE-1306
|
||||
"""
|
||||
|
||||
import pytest
|
||||
from firebird.qa import db_factory, isql_act, Action
|
||||
from firebird.qa import *
|
||||
|
||||
# version: 3.0
|
||||
# resources: None
|
||||
|
||||
substitutions_1 = []
|
||||
|
||||
init_script_1 = """CREATE TABLE "TABLE" (ID INTEGER NOT NULL PRIMARY KEY);
|
||||
init_script = """CREATE TABLE "TABLE" (ID INTEGER NOT NULL PRIMARY KEY);
|
||||
|
||||
COMMIT;
|
||||
|
||||
@ -30,18 +25,18 @@ CREATE VIEW "VIEW" AS SELECT * FROM "TABLE";
|
||||
|
||||
commit;"""
|
||||
|
||||
db_1 = db_factory(sql_dialect=3, init=init_script_1)
|
||||
db = db_factory(init=init_script)
|
||||
|
||||
test_script_1 = """set plan on;
|
||||
test_script = """set plan on;
|
||||
|
||||
SELECT * FROM "TABLE" WHERE ID = 1
|
||||
UNION ALL
|
||||
SELECT * FROM "VIEW" WHERE ID = 1 ;
|
||||
"""
|
||||
|
||||
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
|
||||
act = isql_act('db', test_script)
|
||||
|
||||
expected_stdout_1 = """
|
||||
expected_stdout = """
|
||||
PLAN (TABLE INDEX (RDB$PRIMARY1), VIEW TABLE INDEX (RDB$PRIMARY1))
|
||||
|
||||
ID
|
||||
@ -52,8 +47,8 @@ PLAN (TABLE INDEX (RDB$PRIMARY1), VIEW TABLE INDEX (RDB$PRIMARY1))
|
||||
"""
|
||||
|
||||
@pytest.mark.version('>=3.0')
|
||||
def test_1(act_1: Action):
|
||||
act_1.expected_stdout = expected_stdout_1
|
||||
act_1.execute()
|
||||
assert act_1.clean_stdout == act_1.clean_expected_stdout
|
||||
def test_1(act: Action):
|
||||
act.expected_stdout = expected_stdout
|
||||
act.execute()
|
||||
assert act.clean_stdout == act.clean_expected_stdout
|
||||
|
||||
|
@ -1,39 +1,32 @@
|
||||
#coding:utf-8
|
||||
#
|
||||
# id: bugs.core_1312
|
||||
# title: A remote attacker can check, if a file is present in the system, running firebird server
|
||||
# decription: Check if password validation is done as soon as possible
|
||||
# tracker_id: CORE-1312
|
||||
# min_versions: []
|
||||
# versions: 2.5.0
|
||||
# qmid: bugs.core_1312-250
|
||||
|
||||
"""
|
||||
ID: issue-1731
|
||||
ISSUE: 1731
|
||||
TITLE: A remote attacker can check, if a file is present in the system, running firebird server
|
||||
DESCRIPTION: Check if password validation is done as soon as possible
|
||||
JIRA: CORE-1312
|
||||
"""
|
||||
|
||||
import pytest
|
||||
from firebird.qa import db_factory, isql_act, Action
|
||||
from firebird.qa import *
|
||||
|
||||
# version: 2.5.0
|
||||
# resources: None
|
||||
db = db_factory()
|
||||
|
||||
substitutions_1 = []
|
||||
|
||||
init_script_1 = """"""
|
||||
|
||||
db_1 = db_factory(sql_dialect=3, init=init_script_1)
|
||||
|
||||
test_script_1 = """
|
||||
test_script = """
|
||||
commit;
|
||||
connect 'localhost:bla' user 'qqq' password 'zzz';
|
||||
"""
|
||||
|
||||
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
|
||||
act = isql_act('db', test_script)
|
||||
|
||||
expected_stderr_1 = """Statement failed, SQLSTATE = 28000
|
||||
expected_stderr = """Statement failed, SQLSTATE = 28000
|
||||
Your user name and password are not defined. Ask your database administrator to set up a Firebird login.
|
||||
"""
|
||||
|
||||
@pytest.mark.version('>=2.5.0')
|
||||
def test_1(act_1: Action):
|
||||
act_1.expected_stderr = expected_stderr_1
|
||||
act_1.execute()
|
||||
assert act_1.clean_stderr == act_1.clean_expected_stderr
|
||||
@pytest.mark.version('>=3')
|
||||
def test_1(act: Action):
|
||||
act.expected_stderr = expected_stderr
|
||||
act.execute()
|
||||
assert act.clean_stderr == act.clean_expected_stderr
|
||||
|
||||
|
@ -1,26 +1,19 @@
|
||||
#coding:utf-8
|
||||
#
|
||||
# id: bugs.core_1313
|
||||
# title: RDB$DB_KEY not supported in derived tables and merge command
|
||||
# decription:
|
||||
# tracker_id: CORE-1313
|
||||
# min_versions: []
|
||||
# versions: 2.5
|
||||
# qmid: bugs.core_1313
|
||||
|
||||
"""
|
||||
ID: issue-1732
|
||||
ISSUE: 1732
|
||||
TITLE: RDB$DB_KEY not supported in derived tables and merge command
|
||||
DESCRIPTION:
|
||||
JIRA: CORE-1313
|
||||
"""
|
||||
|
||||
import pytest
|
||||
from firebird.qa import db_factory, isql_act, Action
|
||||
from firebird.qa import *
|
||||
|
||||
# version: 2.5
|
||||
# resources: None
|
||||
db = db_factory()
|
||||
|
||||
substitutions_1 = [('=', ''), ('[ \t]+', ' ')]
|
||||
|
||||
init_script_1 = """"""
|
||||
|
||||
db_1 = db_factory(sql_dialect=3, init=init_script_1)
|
||||
|
||||
test_script_1 = """
|
||||
test_script = """
|
||||
create table t (c1 integer);
|
||||
commit;
|
||||
|
||||
@ -29,7 +22,7 @@ test_script_1 = """
|
||||
insert into t values (3);
|
||||
|
||||
commit;
|
||||
|
||||
|
||||
select 'point-1' msg, t1.*
|
||||
from t t1
|
||||
right join (select t.rdb$db_key as dbkey from t) t2 on t2.dbkey = t1.rdb$db_key;
|
||||
@ -42,9 +35,9 @@ test_script_1 = """
|
||||
select 'point-2' msg, t.* from t;
|
||||
"""
|
||||
|
||||
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
|
||||
act = isql_act('db', test_script, substitutions=[('=', ''), ('[ \t]+', ' ')])
|
||||
|
||||
expected_stdout_1 = """
|
||||
expected_stdout = """
|
||||
MSG C1
|
||||
point-1 1
|
||||
point-1 2
|
||||
@ -56,9 +49,9 @@ expected_stdout_1 = """
|
||||
point-2 3
|
||||
"""
|
||||
|
||||
@pytest.mark.version('>=2.5')
|
||||
def test_1(act_1: Action):
|
||||
act_1.expected_stdout = expected_stdout_1
|
||||
act_1.execute()
|
||||
assert act_1.clean_stdout == act_1.clean_expected_stdout
|
||||
@pytest.mark.version('>=3')
|
||||
def test_1(act: Action):
|
||||
act.expected_stdout = expected_stdout
|
||||
act.execute()
|
||||
assert act.clean_stdout == act.clean_expected_stdout
|
||||
|
||||
|
@ -1,43 +1,21 @@
|
||||
#coding:utf-8
|
||||
#
|
||||
# id: bugs.core_1315
|
||||
# title: Data type unknown
|
||||
# decription:
|
||||
# tracker_id: CORE-1315
|
||||
# min_versions: []
|
||||
# versions: 2.1
|
||||
# qmid: bugs.core_1315
|
||||
|
||||
"""
|
||||
ID: issue-1734
|
||||
ISSUE: 1734
|
||||
TITLE: Data type unknown
|
||||
DESCRIPTION:
|
||||
JIRA: CORE-1315
|
||||
"""
|
||||
|
||||
import pytest
|
||||
from firebird.qa import db_factory, python_act, Action
|
||||
from firebird.qa import *
|
||||
|
||||
# version: 2.1
|
||||
# resources: None
|
||||
db = db_factory()
|
||||
|
||||
substitutions_1 = []
|
||||
act = python_act('db')
|
||||
|
||||
init_script_1 = """"""
|
||||
|
||||
db_1 = db_factory(sql_dialect=3, init=init_script_1)
|
||||
|
||||
# test_script_1
|
||||
#---
|
||||
# cur = db_conn.cursor()
|
||||
# try:
|
||||
# statement = cur.prep('select coalesce(?,1) from RDB$DATABASE')
|
||||
# except Exception,e:
|
||||
# print ('Failed!',e)
|
||||
# else:
|
||||
# cur.execute(statement,[2])
|
||||
# printData(cur)
|
||||
# print()
|
||||
# cur.execute(statement,[None])
|
||||
# printData(cur)
|
||||
#---
|
||||
|
||||
act_1 = python_act('db_1', substitutions=substitutions_1)
|
||||
|
||||
expected_stdout_1 = """COALESCE
|
||||
expected_stdout = """COALESCE
|
||||
-----------
|
||||
2
|
||||
|
||||
@ -46,17 +24,17 @@ COALESCE
|
||||
1
|
||||
"""
|
||||
|
||||
@pytest.mark.version('>=2.1')
|
||||
def test_1(act_1: Action, capsys):
|
||||
with act_1.db.connect() as con:
|
||||
@pytest.mark.version('>=3')
|
||||
def test_1(act: Action, capsys):
|
||||
with act.db.connect() as con:
|
||||
c = con.cursor()
|
||||
statement = c.prepare('select coalesce(?,1) from RDB$DATABASE')
|
||||
c.execute(statement,[2])
|
||||
act_1.print_data(c)
|
||||
act.print_data(c)
|
||||
c.execute(statement,[None])
|
||||
act_1.print_data(c)
|
||||
act_1.stdout = capsys.readouterr().out
|
||||
act_1.expected_stdout = expected_stdout_1
|
||||
assert act_1.clean_stdout == act_1.clean_expected_stdout
|
||||
act.print_data(c)
|
||||
act.stdout = capsys.readouterr().out
|
||||
act.expected_stdout = expected_stdout
|
||||
assert act.clean_stdout == act.clean_expected_stdout
|
||||
|
||||
|
||||
|
@ -1,26 +1,19 @@
|
||||
#coding:utf-8
|
||||
#
|
||||
# id: bugs.core_1316
|
||||
# title: NOT NULL constraint for procedure parameters and variables
|
||||
# decription:
|
||||
# tracker_id: CORE-1316
|
||||
# min_versions: []
|
||||
# versions: 2.5
|
||||
# qmid: bugs.core_1316
|
||||
|
||||
"""
|
||||
ID: issue-1735
|
||||
ISSUE: 1735
|
||||
TITLE: NOT NULL constraint for procedure parameters and variables
|
||||
DESCRIPTION:
|
||||
JIRA: CORE-1316
|
||||
"""
|
||||
|
||||
import pytest
|
||||
from firebird.qa import db_factory, isql_act, Action
|
||||
from firebird.qa import *
|
||||
|
||||
# version: 2.5
|
||||
# resources: None
|
||||
db = db_factory()
|
||||
|
||||
substitutions_1 = [('line: \\d+, col: \\d+', '')]
|
||||
|
||||
init_script_1 = """"""
|
||||
|
||||
db_1 = db_factory(sql_dialect=3, init=init_script_1)
|
||||
|
||||
test_script_1 = """create procedure get_something(id integer not null) as begin end;
|
||||
test_script = """create procedure get_something(id integer not null) as begin end;
|
||||
commit;
|
||||
execute procedure get_something(NULL);
|
||||
execute procedure get_something(1);
|
||||
@ -32,9 +25,9 @@ execute procedure p0(null);
|
||||
execute procedure p0(1);
|
||||
"""
|
||||
|
||||
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
|
||||
act = isql_act('db', test_script, substitutions=[('line: \\d+, col: \\d+', '')])
|
||||
|
||||
expected_stderr_1 = """Statement failed, SQLSTATE = 42000
|
||||
expected_stderr = """Statement failed, SQLSTATE = 42000
|
||||
validation error for variable ID, value "*** null ***"
|
||||
-At procedure 'GET_SOMETHING'
|
||||
Statement failed, SQLSTATE = 42000
|
||||
@ -42,9 +35,9 @@ validation error for variable I, value "*** null ***"
|
||||
-At procedure 'P0' line: 1, col: 63
|
||||
"""
|
||||
|
||||
@pytest.mark.version('>=2.5')
|
||||
def test_1(act_1: Action):
|
||||
act_1.expected_stderr = expected_stderr_1
|
||||
act_1.execute()
|
||||
assert act_1.clean_stderr == act_1.clean_expected_stderr
|
||||
@pytest.mark.version('>=3')
|
||||
def test_1(act: Action):
|
||||
act.expected_stderr = expected_stderr
|
||||
act.execute()
|
||||
assert act.clean_stderr == act.clean_expected_stderr
|
||||
|
||||
|
@ -1,30 +1,23 @@
|
||||
#coding:utf-8
|
||||
#
|
||||
# id: bugs.core_1318
|
||||
# title: Error "Identifier ... is too long using multiple (nested) derived tables
|
||||
# decription:
|
||||
# tracker_id: CORE-1318
|
||||
# min_versions: ['2.0.7']
|
||||
# versions: 2.0.7
|
||||
# qmid: bugs.core_1318
|
||||
|
||||
"""
|
||||
ID: issue-1737
|
||||
ISSUE: 1737
|
||||
TITLE: Error "Identifier ... is too long using multiple (nested) derived tables
|
||||
DESCRIPTION:
|
||||
JIRA: CORE-1318
|
||||
"""
|
||||
|
||||
import pytest
|
||||
from firebird.qa import db_factory, isql_act, Action
|
||||
from firebird.qa import *
|
||||
|
||||
# version: 2.0.7
|
||||
# resources: None
|
||||
db = db_factory()
|
||||
|
||||
substitutions_1 = []
|
||||
|
||||
init_script_1 = """"""
|
||||
|
||||
db_1 = db_factory(sql_dialect=3, init=init_script_1)
|
||||
|
||||
test_script_1 = """
|
||||
test_script = """
|
||||
set list on;
|
||||
select 0*count(*) cnt
|
||||
from (
|
||||
select A1.ID
|
||||
select A1.ID
|
||||
from(
|
||||
select A2.ID from(
|
||||
select A3.ID from(
|
||||
@ -36,10 +29,10 @@ test_script_1 = """
|
||||
select A9.ID from(
|
||||
select A10.ID from(
|
||||
select rdb$relations.rdb$relation_id as id from rdb$relations where rdb$relations.rdb$relation_id = 1
|
||||
) as A10
|
||||
union
|
||||
) as A10
|
||||
union
|
||||
select rdb$relations.rdb$relation_id as id from rdb$relations where rdb$relations.rdb$relation_id = 2
|
||||
) as A9
|
||||
) as A9
|
||||
union
|
||||
select rdb$relations.rdb$relation_id as id from rdb$relations where rdb$relations.rdb$relation_id = 3
|
||||
) as A8
|
||||
@ -70,15 +63,15 @@ test_script_1 = """
|
||||
;
|
||||
"""
|
||||
|
||||
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
|
||||
act = isql_act('db', test_script)
|
||||
|
||||
expected_stdout_1 = """
|
||||
expected_stdout = """
|
||||
CNT 0
|
||||
"""
|
||||
|
||||
@pytest.mark.version('>=2.0.7')
|
||||
def test_1(act_1: Action):
|
||||
act_1.expected_stdout = expected_stdout_1
|
||||
act_1.execute()
|
||||
assert act_1.clean_stdout == act_1.clean_expected_stdout
|
||||
@pytest.mark.version('>=3')
|
||||
def test_1(act: Action):
|
||||
act.expected_stdout = expected_stdout
|
||||
act.execute()
|
||||
assert act.clean_stdout == act.clean_expected_stdout
|
||||
|
||||
|
@ -1,26 +1,19 @@
|
||||
#coding:utf-8
|
||||
#
|
||||
# id: bugs.core_1329
|
||||
# title: size of alias name in a table
|
||||
# decription: Bug with size of alias name in a table (but still minor that 31 characters)
|
||||
# tracker_id: CORE-1329
|
||||
# min_versions: []
|
||||
# versions: 2.0.1
|
||||
# qmid: bugs.core_1329
|
||||
|
||||
"""
|
||||
ID: issue-1748
|
||||
ISSUE: 1748
|
||||
TITLE: Bug with size of alias name in a table (but still minor that 31 characters)
|
||||
DESCRIPTION:
|
||||
JIRA: CORE-1329
|
||||
"""
|
||||
|
||||
import pytest
|
||||
from firebird.qa import db_factory, isql_act, Action
|
||||
from firebird.qa import *
|
||||
|
||||
# version: 2.0.1
|
||||
# resources: None
|
||||
db = db_factory()
|
||||
|
||||
substitutions_1 = []
|
||||
|
||||
init_script_1 = """"""
|
||||
|
||||
db_1 = db_factory(sql_dialect=3, init=init_script_1)
|
||||
|
||||
test_script_1 = """CREATE TABLE BIG_TABLE_1234567890123 (COD INTEGER NOT NULL PRIMARY KEY);
|
||||
test_script = """CREATE TABLE BIG_TABLE_1234567890123 (COD INTEGER NOT NULL PRIMARY KEY);
|
||||
COMMIT;
|
||||
SELECT
|
||||
BIG_TABLE_1234567890123.COD
|
||||
@ -33,10 +26,11 @@ JOIN (SELECT
|
||||
BIG_TABLE_1234567890123.COD = BIG_TABLE_1234567890123_.COD;
|
||||
"""
|
||||
|
||||
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
|
||||
|
||||
|
||||
@pytest.mark.version('>=2.0.1')
|
||||
def test_1(act_1: Action):
|
||||
act_1.execute()
|
||||
act = isql_act('db', test_script)
|
||||
|
||||
@pytest.mark.version('>=3')
|
||||
def test_1(act: Action):
|
||||
try:
|
||||
act.execute()
|
||||
except ExecutionError as e:
|
||||
pytest.fail("Test script execution failed", pytrace=False)
|
||||
|
@ -1,26 +1,19 @@
|
||||
#coding:utf-8
|
||||
#
|
||||
# id: bugs.core_1331
|
||||
# title: Charset transliterations don't work with EXECUTE STATEMENT
|
||||
# decription:
|
||||
# tracker_id: CORE-1331
|
||||
# min_versions: []
|
||||
# versions: 3.0
|
||||
# qmid: bugs.core_1331
|
||||
|
||||
"""
|
||||
ID: issue-1750
|
||||
ISSUE: 1750
|
||||
TITLE: Charset transliterations don't work with EXECUTE STATEMENT
|
||||
DESCRIPTION:
|
||||
JIRA: CORE-1331
|
||||
"""
|
||||
|
||||
import pytest
|
||||
from firebird.qa import db_factory, isql_act, Action
|
||||
from firebird.qa import *
|
||||
|
||||
# version: 3.0
|
||||
# resources: None
|
||||
db = db_factory(from_backup='core1331-25.fbk', charset='utf8')
|
||||
|
||||
substitutions_1 = []
|
||||
|
||||
init_script_1 = """"""
|
||||
|
||||
db_1 = db_factory(from_backup='core1331-25.fbk', init=init_script_1, charset='utf8')
|
||||
|
||||
test_script_1 = """
|
||||
test_script = """
|
||||
set list on;
|
||||
select opis as direct_select from T1;
|
||||
set term ^ ;
|
||||
@ -43,9 +36,9 @@ test_script_1 = """
|
||||
set term ;^
|
||||
"""
|
||||
|
||||
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
|
||||
act = isql_act('db', test_script)
|
||||
|
||||
expected_stdout_1 = """
|
||||
expected_stdout = """
|
||||
DIRECT_SELECT ASCII
|
||||
DIRECT_SELECT милан
|
||||
EXECUTE_BLOCK_SELECT ASCII
|
||||
@ -55,8 +48,8 @@ expected_stdout_1 = """
|
||||
"""
|
||||
|
||||
@pytest.mark.version('>=3.0')
|
||||
def test_1(act_1: Action):
|
||||
act_1.expected_stdout = expected_stdout_1
|
||||
act_1.execute()
|
||||
assert act_1.clean_stdout == act_1.clean_expected_stdout
|
||||
def test_1(act: Action):
|
||||
act.expected_stdout = expected_stdout
|
||||
act.execute()
|
||||
assert act.clean_stdout == act.clean_expected_stdout
|
||||
|
||||
|
@ -1,22 +1,17 @@
|
||||
#coding:utf-8
|
||||
#
|
||||
# id: bugs.core_1334
|
||||
# title: Joins with NULL RDB$DB_KEY crash the server
|
||||
# decription:
|
||||
# tracker_id: CORE-1334
|
||||
# min_versions: []
|
||||
# versions: 2.1
|
||||
# qmid: bugs.core_1334
|
||||
|
||||
"""
|
||||
ID: issue-1753
|
||||
ISSUE: 1753
|
||||
TITLE: Joins with NULL RDB$DB_KEY crash the server
|
||||
DESCRIPTION:
|
||||
JIRA: CORE-1334
|
||||
"""
|
||||
|
||||
import pytest
|
||||
from firebird.qa import db_factory, isql_act, Action
|
||||
from firebird.qa import *
|
||||
|
||||
# version: 2.1
|
||||
# resources: None
|
||||
|
||||
substitutions_1 = []
|
||||
|
||||
init_script_1 = """create table t1 (id integer primary key);
|
||||
init_script = """create table t1 (id integer primary key);
|
||||
create table t2 (id integer references t1);
|
||||
COMMIT;
|
||||
insert into t1 values (1);
|
||||
@ -24,9 +19,9 @@ insert into t1 values (2);
|
||||
insert into t2 values (2);
|
||||
COMMIT;"""
|
||||
|
||||
db_1 = db_factory(sql_dialect=3, init=init_script_1)
|
||||
db = db_factory(init=init_script)
|
||||
|
||||
test_script_1 = """select *
|
||||
test_script = """select *
|
||||
from t1
|
||||
left join t2
|
||||
on (t2.id = t1.id)
|
||||
@ -34,9 +29,9 @@ test_script_1 = """select *
|
||||
on (t3.rdb$db_key = t2.rdb$db_key);
|
||||
"""
|
||||
|
||||
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
|
||||
act = isql_act('db', test_script)
|
||||
|
||||
expected_stdout_1 = """
|
||||
expected_stdout = """
|
||||
ID ID ID
|
||||
============ ============ ============
|
||||
1 <null> <null>
|
||||
@ -44,9 +39,9 @@ expected_stdout_1 = """
|
||||
|
||||
"""
|
||||
|
||||
@pytest.mark.version('>=2.1')
|
||||
def test_1(act_1: Action):
|
||||
act_1.expected_stdout = expected_stdout_1
|
||||
act_1.execute()
|
||||
assert act_1.clean_stdout == act_1.clean_expected_stdout
|
||||
@pytest.mark.version('>=3')
|
||||
def test_1(act: Action):
|
||||
act.expected_stdout = expected_stdout
|
||||
act.execute()
|
||||
assert act.clean_stdout == act.clean_expected_stdout
|
||||
|
||||
|
@ -1,26 +1,20 @@
|
||||
#coding:utf-8
|
||||
#
|
||||
# id: bugs.core_1338
|
||||
# title: Problem with view , computed field and functions
|
||||
# decription:
|
||||
# tracker_id: CORE-1338
|
||||
# min_versions: []
|
||||
# versions: 2.1
|
||||
# qmid: bugs.core_1338
|
||||
|
||||
"""
|
||||
ID: issue-1757
|
||||
ISSUE: 1757
|
||||
TITLE: Problem with view, computed field and functions
|
||||
DESCRIPTION:
|
||||
Original ticket name: 335544721 when selecting view with round
|
||||
JIRA: CORE-1338
|
||||
"""
|
||||
|
||||
import pytest
|
||||
from firebird.qa import db_factory, isql_act, Action
|
||||
from firebird.qa import *
|
||||
|
||||
# version: 2.1
|
||||
# resources: None
|
||||
db = db_factory()
|
||||
|
||||
substitutions_1 = []
|
||||
|
||||
init_script_1 = """"""
|
||||
|
||||
db_1 = db_factory(sql_dialect=3, init=init_script_1)
|
||||
|
||||
test_script_1 = """create table a (a numeric(15,15));
|
||||
test_script = """create table a (a numeric(15,15));
|
||||
|
||||
insert into a values(2);
|
||||
|
||||
@ -29,18 +23,18 @@ create view b(a) as select round(a,2) from a;
|
||||
select * from b;
|
||||
"""
|
||||
|
||||
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
|
||||
act = isql_act('db', test_script)
|
||||
|
||||
expected_stdout_1 = """
|
||||
expected_stdout = """
|
||||
A
|
||||
=====================
|
||||
2.000000000000000
|
||||
|
||||
"""
|
||||
|
||||
@pytest.mark.version('>=2.1')
|
||||
def test_1(act_1: Action):
|
||||
act_1.expected_stdout = expected_stdout_1
|
||||
act_1.execute()
|
||||
assert act_1.clean_stdout == act_1.clean_expected_stdout
|
||||
@pytest.mark.version('>=3')
|
||||
def test_1(act: Action):
|
||||
act.expected_stdout = expected_stdout
|
||||
act.execute()
|
||||
assert act.clean_stdout == act.clean_expected_stdout
|
||||
|
||||
|
@ -1,26 +1,19 @@
|
||||
#coding:utf-8
|
||||
#
|
||||
# id: bugs.core_1343
|
||||
# title: Bug with a simple case and a subquery
|
||||
# decription:
|
||||
# tracker_id: CORE-1343
|
||||
# min_versions: []
|
||||
# versions: 2.5
|
||||
# qmid: None
|
||||
|
||||
"""
|
||||
ID: issue-1762
|
||||
ISSUE: 1762
|
||||
TITLE: Bug with a simple case and a subquery
|
||||
DESCRIPTION:
|
||||
JIRA: CORE-1343
|
||||
"""
|
||||
|
||||
import pytest
|
||||
from firebird.qa import db_factory, isql_act, Action
|
||||
from firebird.qa import *
|
||||
|
||||
# version: 2.5
|
||||
# resources: None
|
||||
db = db_factory()
|
||||
|
||||
substitutions_1 = []
|
||||
|
||||
init_script_1 = """"""
|
||||
|
||||
db_1 = db_factory(page_size=4096, sql_dialect=3, init=init_script_1)
|
||||
|
||||
test_script_1 = """--works fine (searched case with a subquery)
|
||||
test_script = """--works fine (searched case with a subquery)
|
||||
|
||||
SELECT
|
||||
CASE
|
||||
@ -64,9 +57,9 @@ context already in use (BLR error).
|
||||
*/
|
||||
"""
|
||||
|
||||
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
|
||||
act = isql_act('db', test_script)
|
||||
|
||||
expected_stdout_1 = """
|
||||
expected_stdout = """
|
||||
CASE
|
||||
======
|
||||
Y
|
||||
@ -83,9 +76,9 @@ Y
|
||||
|
||||
"""
|
||||
|
||||
@pytest.mark.version('>=2.5')
|
||||
def test_1(act_1: Action):
|
||||
act_1.expected_stdout = expected_stdout_1
|
||||
act_1.execute()
|
||||
assert act_1.clean_stdout == act_1.clean_expected_stdout
|
||||
@pytest.mark.version('>=3')
|
||||
def test_1(act: Action):
|
||||
act.expected_stdout = expected_stdout
|
||||
act.execute()
|
||||
assert act.clean_stdout == act.clean_expected_stdout
|
||||
|
||||
|
@ -1,40 +1,33 @@
|
||||
#coding:utf-8
|
||||
#
|
||||
# id: bugs.core_1346
|
||||
# title: lpad and rpad with two columns not working
|
||||
# decription:
|
||||
# tracker_id: CORE-1346
|
||||
# min_versions: []
|
||||
# versions: 2.1.4
|
||||
# qmid: None
|
||||
|
||||
import pytest
|
||||
from firebird.qa import db_factory, isql_act, Action
|
||||
|
||||
# version: 2.1.4
|
||||
# resources: None
|
||||
|
||||
substitutions_1 = []
|
||||
|
||||
init_script_1 = """"""
|
||||
|
||||
db_1 = db_factory(page_size=4096, sql_dialect=3, init=init_script_1)
|
||||
|
||||
test_script_1 = """select lpad('xxx', 8, '0') one, lpad('yyy', 8, '0') two from rdb$database;
|
||||
"""
|
||||
ID: issue-1765
|
||||
ISSUE: 1765
|
||||
TITLE: lpad and rpad with two columns not working
|
||||
DESCRIPTION:
|
||||
JIRA: CORE-1346
|
||||
"""
|
||||
|
||||
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
|
||||
import pytest
|
||||
from firebird.qa import *
|
||||
|
||||
expected_stdout_1 = """
|
||||
db = db_factory()
|
||||
|
||||
test_script = """select lpad('xxx', 8, '0') one, lpad('yyy', 8, '0') two from rdb$database;
|
||||
"""
|
||||
|
||||
act = isql_act('db', test_script)
|
||||
|
||||
expected_stdout = """
|
||||
ONE TWO
|
||||
======== ========
|
||||
00000xxx 00000yyy
|
||||
|
||||
"""
|
||||
|
||||
@pytest.mark.version('>=2.1.4')
|
||||
def test_1(act_1: Action):
|
||||
act_1.expected_stdout = expected_stdout_1
|
||||
act_1.execute()
|
||||
assert act_1.clean_stdout == act_1.clean_expected_stdout
|
||||
@pytest.mark.version('>=3')
|
||||
def test_1(act: Action):
|
||||
act.expected_stdout = expected_stdout
|
||||
act.execute()
|
||||
assert act.clean_stdout == act.clean_expected_stdout
|
||||
|
||||
|
@ -1,149 +1,27 @@
|
||||
#coding:utf-8
|
||||
#
|
||||
# id: bugs.core_1347
|
||||
# title: Unexpected "cannot transliterate" error
|
||||
# decription:
|
||||
# 05-mar-2021. Re-implemented in order to have ability to run this test on Linux.
|
||||
# Test encodes to UTF8 all needed statements (SET NAMES; CONNECT; DDL and DML) and stores this text in .sql file.
|
||||
# NOTE: 'SET NAMES' contain character set that must be used for reproducing problem (WIN1251 in this test).
|
||||
# Then ISQL is launched in separate (child) process which performs all necessary actions (using required charset).
|
||||
# Result will be redirected to log(s) which will be opened further via codecs.open(...encoding='cp1251').
|
||||
# Finally, its content will be converted to UTF8 for showing in expected_stdout.
|
||||
# Checked on:
|
||||
# * Windows: 4.0.0.2377, 3.0.8.33423; old version: 3.0.4.32972, 3.0.2.32703, 3.0.1.32609, 3.0.0.32483, 2.5.9.27152
|
||||
# * Linux: 4.0.0.2379, 3.0.8.33415
|
||||
#
|
||||
# tracker_id: CORE-1347
|
||||
# min_versions: ['2.5.0']
|
||||
# versions: 2.5
|
||||
# qmid: None
|
||||
|
||||
"""
|
||||
ID: issue-1766
|
||||
ISSUE: 1766
|
||||
TITLE: Unexpected "cannot transliterate" error
|
||||
DESCRIPTION:
|
||||
JIRA: CORE-1347
|
||||
"""
|
||||
|
||||
import pytest
|
||||
from firebird.qa import db_factory, python_act, Action, temp_file
|
||||
from firebird.qa import *
|
||||
from pathlib import Path
|
||||
|
||||
# version: 2.5
|
||||
# resources: None
|
||||
db = db_factory(charset='WIN1251')
|
||||
|
||||
substitutions_1 = []
|
||||
act = python_act('db')
|
||||
|
||||
init_script_1 = """"""
|
||||
|
||||
db_1 = db_factory(charset='WIN1251', sql_dialect=3, init=init_script_1)
|
||||
|
||||
# test_script_1
|
||||
#---
|
||||
#
|
||||
# import os
|
||||
# import codecs
|
||||
# import subprocess
|
||||
# import time
|
||||
# engine = db_conn.engine_version
|
||||
# db_conn.close()
|
||||
#
|
||||
# #--------------------------------------------
|
||||
#
|
||||
# def flush_and_close( file_handle ):
|
||||
# # https://docs.python.org/2/library/os.html#os.fsync
|
||||
# # If you're starting with a Python file object f,
|
||||
# # first do f.flush(), and
|
||||
# # then do os.fsync(f.fileno()), to ensure that all internal buffers associated with f are written to disk.
|
||||
# global os
|
||||
#
|
||||
# file_handle.flush()
|
||||
# if file_handle.mode not in ('r', 'rb') and file_handle.name != os.devnull:
|
||||
# # otherwise: "OSError: [Errno 9] Bad file descriptor"!
|
||||
# os.fsync(file_handle.fileno())
|
||||
# file_handle.close()
|
||||
#
|
||||
# #--------------------------------------------
|
||||
#
|
||||
# def cleanup( f_names_list ):
|
||||
# global os
|
||||
# for i in range(len( f_names_list )):
|
||||
# if type(f_names_list[i]) == file:
|
||||
# del_name = f_names_list[i].name
|
||||
# elif type(f_names_list[i]) == str:
|
||||
# del_name = f_names_list[i]
|
||||
# else:
|
||||
# print('Unrecognized type of element:', f_names_list[i], ' - can not be treated as file.')
|
||||
# del_name = None
|
||||
#
|
||||
# if del_name and os.path.isfile( del_name ):
|
||||
# os.remove( del_name )
|
||||
#
|
||||
# #--------------------------------------------
|
||||
#
|
||||
# sql_txt=''' set bail on;
|
||||
# set names win1251;
|
||||
# connect '%(dsn)s' user '%(user_name)s' password '%(user_password)s';
|
||||
#
|
||||
# set term ^ ;
|
||||
# create procedure sp_test (
|
||||
# p_tablename varchar(30) ,
|
||||
# p_idname varchar(30) ,
|
||||
# p_seqname varchar(30) ,
|
||||
# p_isusefunc smallint
|
||||
# )
|
||||
# returns (
|
||||
# column_value bigint
|
||||
# )
|
||||
# as
|
||||
# declare variable l_maxid bigint;
|
||||
# begin
|
||||
# /*
|
||||
# -- Находим разрыв в значениях ПК таблицы
|
||||
# -- если разрыв отсутствует то дергаем секвенс
|
||||
# -- p_IsUseFunc=1 - дергать секвенс ч/з ф-цию GetSeqValue
|
||||
# */
|
||||
# end ^
|
||||
# set term ;^
|
||||
# commit;
|
||||
#
|
||||
# set list on;
|
||||
# set count on;
|
||||
#
|
||||
# select pr.rdb$procedure_name
|
||||
# from rdb$procedures pr
|
||||
# where pr.rdb$procedure_source containing '1'
|
||||
# and pr.rdb$procedure_name = upper('sp_test');
|
||||
#
|
||||
# ''' % dict(globals(), **locals())
|
||||
#
|
||||
# f_run_sql = open( os.path.join(context['temp_directory'], 'tmp_5325_win1251.sql'), 'w' )
|
||||
# f_run_sql.write( sql_txt.decode('utf8').encode('cp1251') )
|
||||
# flush_and_close( f_run_sql )
|
||||
#
|
||||
# # result: file tmp_5325_win1251.sql is encoded in win1251
|
||||
#
|
||||
# f_run_log = open( os.path.splitext(f_run_sql.name)[0]+'.log', 'w')
|
||||
# subprocess.call( [ context['isql_path'], '-q', '-i', f_run_sql.name ],
|
||||
# stdout = f_run_log,
|
||||
# stderr = subprocess.STDOUT
|
||||
# )
|
||||
# flush_and_close( f_run_log ) # result: output will be encoded in win1251
|
||||
#
|
||||
# with codecs.open(f_run_log.name, 'r', encoding='cp1251' ) as f:
|
||||
# result_in_win1251 = f.readlines()
|
||||
#
|
||||
# for i in result_in_win1251:
|
||||
# print( i.encode('utf8') )
|
||||
#
|
||||
# # cleanup:
|
||||
# ###########
|
||||
# cleanup( (f_run_sql, f_run_log) )
|
||||
#
|
||||
#
|
||||
#---
|
||||
|
||||
act_1 = python_act('db_1', substitutions=substitutions_1)
|
||||
|
||||
expected_stdout_1 = """
|
||||
expected_stdout = """
|
||||
RDB$PROCEDURE_NAME SP_TEST
|
||||
Records affected: 1
|
||||
"""
|
||||
|
||||
tmp_file_1 = temp_file('non_ascii_ddl.sql')
|
||||
tmp_file = temp_file('non_ascii_ddl.sql')
|
||||
|
||||
sql_txt = '''set bail on;
|
||||
|
||||
@ -178,11 +56,11 @@ where pr.rdb$procedure_source containing '1'
|
||||
and pr.rdb$procedure_name = upper('sp_test');
|
||||
'''
|
||||
|
||||
@pytest.mark.version('>=2.5')
|
||||
def test_1(act_1: Action, tmp_file_1: Path):
|
||||
tmp_file_1.write_bytes(sql_txt.encode('cp1251'))
|
||||
act_1.expected_stdout = expected_stdout_1
|
||||
act_1.isql(switches=['-q'], input_file=tmp_file_1, charset='win1251', io_enc='cp1251')
|
||||
assert act_1.clean_stdout == act_1.clean_expected_stdout
|
||||
@pytest.mark.version('>=3')
|
||||
def test_1(act: Action, tmp_file: Path):
|
||||
tmp_file.write_bytes(sql_txt.encode('cp1251'))
|
||||
act.expected_stdout = expected_stdout
|
||||
act.isql(switches=['-q'], input_file=tmp_file, charset='win1251', io_enc='cp1251')
|
||||
assert act.clean_stdout == act.clean_expected_stdout
|
||||
|
||||
|
||||
|
@ -1,26 +1,19 @@
|
||||
#coding:utf-8
|
||||
#
|
||||
# id: bugs.core_1356
|
||||
# title: TYPE OF COLUMN in PSQL
|
||||
# decription:
|
||||
# tracker_id: CORE-1356
|
||||
# min_versions: ['2.5.0']
|
||||
# versions: 2.5.0
|
||||
# qmid: None
|
||||
|
||||
"""
|
||||
ID: issue-1774
|
||||
ISSUE: 1774
|
||||
TITLE: TYPE OF COLUMN in PSQL
|
||||
DESCRIPTION:
|
||||
JIRA: CORE-1356
|
||||
"""
|
||||
|
||||
import pytest
|
||||
from firebird.qa import db_factory, isql_act, Action
|
||||
from firebird.qa import *
|
||||
|
||||
# version: 2.5.0
|
||||
# resources: None
|
||||
db = db_factory()
|
||||
|
||||
substitutions_1 = []
|
||||
|
||||
init_script_1 = """"""
|
||||
|
||||
db_1 = db_factory(sql_dialect=3, init=init_script_1)
|
||||
|
||||
test_script_1 = """
|
||||
test_script = """
|
||||
create or alter procedure sp_ins_person as begin end;
|
||||
commit;
|
||||
recreate table person (
|
||||
@ -43,10 +36,11 @@ test_script_1 = """
|
||||
--show procedure sp_ins_person;
|
||||
"""
|
||||
|
||||
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
|
||||
|
||||
|
||||
@pytest.mark.version('>=2.5.0')
|
||||
def test_1(act_1: Action):
|
||||
act_1.execute()
|
||||
act = isql_act('db', test_script)
|
||||
|
||||
@pytest.mark.version('>=3')
|
||||
def test_1(act: Action):
|
||||
try:
|
||||
act.execute()
|
||||
except ExecutionError as e:
|
||||
pytest.fail("Test script execution failed", pytrace=False)
|
||||
|
@ -1,28 +1,17 @@
|
||||
#coding:utf-8
|
||||
#
|
||||
# id: bugs.core_1361
|
||||
# title: Index operations for global temporary tables are not visible for the active connection
|
||||
# decription:
|
||||
# Checked on:
|
||||
# 4.0.0.1635 SS: 1.863s.
|
||||
# 4.0.0.1633 CS: 2.386s.
|
||||
# 3.0.5.33180 SS: 1.302s.
|
||||
# 3.0.5.33178 CS: 1.778s.
|
||||
#
|
||||
# tracker_id:
|
||||
# min_versions: ['3.0']
|
||||
# versions: 3.0
|
||||
# qmid: bugs.core_1361
|
||||
|
||||
"""
|
||||
ID: issue-1779
|
||||
ISSUE: 1779
|
||||
TITLE: Index operations for global temporary tables are not visible for the active connection
|
||||
DESCRIPTION:
|
||||
JIRA: CORE-1361
|
||||
"""
|
||||
|
||||
import pytest
|
||||
from firebird.qa import db_factory, isql_act, Action
|
||||
from firebird.qa import *
|
||||
|
||||
# version: 3.0
|
||||
# resources: None
|
||||
|
||||
substitutions_1 = []
|
||||
|
||||
init_script_1 = """
|
||||
init_script = """
|
||||
set term ^;
|
||||
create or alter procedure sp_check_plan returns(sql_plan blob) as
|
||||
begin
|
||||
@ -37,19 +26,19 @@ init_script_1 = """
|
||||
^
|
||||
set term ;^
|
||||
commit;
|
||||
|
||||
|
||||
recreate global temporary table gtt_session(x int, y int) on commit preserve rows;
|
||||
commit;
|
||||
create role poor_dba;
|
||||
create role cool_dba;
|
||||
create role super_dba;
|
||||
commit;
|
||||
|
||||
|
||||
grant poor_dba to sysdba; -- for connect #1
|
||||
grant cool_dba to sysdba; -- for connect #2
|
||||
grant super_dba to sysdba; -- for connect #3 (index also WILL be seen for it)
|
||||
commit;
|
||||
|
||||
|
||||
set term ^;
|
||||
create or alter procedure sp_check_plan returns(sql_plan blob) as
|
||||
declare n int;
|
||||
@ -60,7 +49,7 @@ init_script_1 = """
|
||||
union all
|
||||
select -2, -3
|
||||
from rdb$database;
|
||||
|
||||
|
||||
execute statement
|
||||
'select '
|
||||
|| ' (select count(*) from gtt_session g where g.x + g.y = -5) '
|
||||
@ -76,9 +65,9 @@ init_script_1 = """
|
||||
commit;
|
||||
"""
|
||||
|
||||
db_1 = db_factory(sql_dialect=3, init=init_script_1)
|
||||
db = db_factory(init=init_script)
|
||||
|
||||
test_script_1 = """
|
||||
test_script = """
|
||||
set list on;
|
||||
set blob all;
|
||||
set term ^;
|
||||
@ -91,42 +80,42 @@ test_script_1 = """
|
||||
declare role_3 varchar(31) = 'SUPER_DBA';
|
||||
declare sql_plan blob;
|
||||
begin
|
||||
|
||||
|
||||
v_dbname = 'localhost:' || rdb$get_context('SYSTEM', 'DB_NAME');
|
||||
|
||||
|
||||
execute statement 'select sql_plan from sp_check_plan'
|
||||
on external v_dbname
|
||||
as user v_usr password v_pwd role upper( role_1 )
|
||||
into sql_plan;
|
||||
using_index = iif(sql_plan containing 'GTT_SESSION_X_Y', 1, 0);
|
||||
suspend;
|
||||
|
||||
|
||||
--------------------------------------------------------
|
||||
|
||||
|
||||
execute statement 'create index gtt_session_x_y on gtt_session computed by ( x+y )'
|
||||
with autonomous transaction
|
||||
on external v_dbname
|
||||
as user v_usr password v_pwd role upper( role_2 );
|
||||
-- nb: changing this to 'role_1' will produce in firebird.log:
|
||||
-- internal Firebird consistency check (invalid SEND request (167),
|
||||
as user v_usr password v_pwd role upper( role_2 );
|
||||
-- nb: changing this to 'role_1' will produce in firebird.log:
|
||||
-- internal Firebird consistency check (invalid SEND request (167),
|
||||
-- file: JrdStatement.cpp line: 325)
|
||||
|
||||
|
||||
execute statement 'select sql_plan from sp_check_plan'
|
||||
on external v_dbname
|
||||
as user v_usr password v_pwd role upper( role_2 )
|
||||
into sql_plan;
|
||||
using_index = iif(sql_plan containing 'GTT_SESSION_X_Y', 1, 0);
|
||||
suspend;
|
||||
|
||||
|
||||
--------------------------------------------------------
|
||||
|
||||
|
||||
execute statement 'select sql_plan from sp_check_plan'
|
||||
on external v_dbname
|
||||
as user v_usr password v_pwd role upper( role_3 )
|
||||
into sql_plan;
|
||||
using_index = iif(sql_plan containing 'GTT_SESSION_X_Y', 1, 0);
|
||||
suspend;
|
||||
|
||||
|
||||
end
|
||||
^
|
||||
set term ;^
|
||||
@ -144,21 +133,21 @@ test_script_1 = """
|
||||
-- SQLCODE: -901 / lock time-out on wait transaction / object <this_test_DB> is in use
|
||||
-- #############################################################################################
|
||||
delete from mon$attachments where mon$attachment_id != current_connection;
|
||||
commit;
|
||||
commit;
|
||||
|
||||
"""
|
||||
|
||||
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
|
||||
act = isql_act('db', test_script)
|
||||
|
||||
expected_stdout_1 = """
|
||||
expected_stdout = """
|
||||
USING_INDEX 0
|
||||
USING_INDEX 1
|
||||
USING_INDEX 1
|
||||
"""
|
||||
|
||||
@pytest.mark.version('>=3.0')
|
||||
def test_1(act_1: Action):
|
||||
act_1.expected_stdout = expected_stdout_1
|
||||
act_1.execute()
|
||||
assert act_1.clean_stdout == act_1.clean_expected_stdout
|
||||
def test_1(act: Action):
|
||||
act.expected_stdout = expected_stdout
|
||||
act.execute()
|
||||
assert act.clean_stdout == act.clean_expected_stdout
|
||||
|
||||
|
@ -1,24 +1,19 @@
|
||||
#coding:utf-8
|
||||
#
|
||||
# id: bugs.core_1362
|
||||
# title: Too large numbers cause positive infinity to be inserted into database
|
||||
# decription:
|
||||
# tracker_id: CORE-1362
|
||||
# min_versions: []
|
||||
# versions: 2.5.0, 4.0
|
||||
# qmid: None
|
||||
|
||||
"""
|
||||
ID: issue-1780
|
||||
ISSUE: 1780
|
||||
TITLE: Too large numbers cause positive infinity to be inserted into database
|
||||
DESCRIPTION:
|
||||
JIRA: CORE-1362
|
||||
"""
|
||||
|
||||
import pytest
|
||||
from firebird.qa import db_factory, isql_act, Action
|
||||
from firebird.qa import *
|
||||
|
||||
# version: 2.5.0
|
||||
# resources: None
|
||||
db = db_factory()
|
||||
|
||||
substitutions_1 = []
|
||||
|
||||
init_script_1 = """"""
|
||||
|
||||
db_1 = db_factory(sql_dialect=3, init=init_script_1)
|
||||
# version: 3.0
|
||||
|
||||
test_script_1 = """
|
||||
recreate table test (col1 double precision);
|
||||
@ -30,7 +25,7 @@ test_script_1 = """
|
||||
commit;
|
||||
"""
|
||||
|
||||
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
|
||||
act_1 = isql_act('db', test_script_1)
|
||||
|
||||
expected_stderr_1 = """
|
||||
Statement failed, SQLSTATE = 22003
|
||||
@ -38,20 +33,13 @@ expected_stderr_1 = """
|
||||
-numeric value is out of range
|
||||
"""
|
||||
|
||||
@pytest.mark.version('>=2.5.0,<4.0')
|
||||
@pytest.mark.version('>=3.0,<4.0')
|
||||
def test_1(act_1: Action):
|
||||
act_1.expected_stderr = expected_stderr_1
|
||||
act_1.execute()
|
||||
assert act_1.clean_stderr == act_1.clean_expected_stderr
|
||||
|
||||
# version: 4.0
|
||||
# resources: None
|
||||
|
||||
substitutions_2 = []
|
||||
|
||||
init_script_2 = """"""
|
||||
|
||||
db_2 = db_factory(sql_dialect=3, init=init_script_2)
|
||||
|
||||
test_script_2 = """
|
||||
recreate table test (col1 double precision);
|
||||
@ -63,7 +51,7 @@ test_script_2 = """
|
||||
commit;
|
||||
"""
|
||||
|
||||
act_2 = isql_act('db_2', test_script_2, substitutions=substitutions_2)
|
||||
act_2 = isql_act('db', test_script_2)
|
||||
|
||||
expected_stderr_2 = """
|
||||
Statement failed, SQLSTATE = 22003
|
||||
|
@ -1,40 +1,33 @@
|
||||
#coding:utf-8
|
||||
#
|
||||
# id: bugs.core_1363
|
||||
# title: ISQL crash when converted-from-double string longer than 23 bytes
|
||||
# decription:
|
||||
# tracker_id: CORE-1363
|
||||
# min_versions: ['2.5']
|
||||
# versions: 2.5
|
||||
# qmid: None
|
||||
|
||||
import pytest
|
||||
from firebird.qa import db_factory, isql_act, Action
|
||||
|
||||
# version: 2.5
|
||||
# resources: None
|
||||
|
||||
substitutions_1 = []
|
||||
|
||||
init_script_1 = """"""
|
||||
|
||||
db_1 = db_factory(page_size=4096, sql_dialect=3, init=init_script_1)
|
||||
|
||||
test_script_1 = """select -2.488355210669293e-22 from rdb$database;
|
||||
"""
|
||||
ID: issue-1781
|
||||
ISSUE: 1781
|
||||
TITLE: ISQL crash when converted-from-double string longer than 23 bytes
|
||||
DESCRIPTION:
|
||||
JIRA: CORE-1363
|
||||
"""
|
||||
|
||||
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
|
||||
import pytest
|
||||
from firebird.qa import *
|
||||
|
||||
expected_stdout_1 = """
|
||||
db = db_factory()
|
||||
|
||||
test_script = """select -2.488355210669293e-22 from rdb$database;
|
||||
"""
|
||||
|
||||
act = isql_act('db', test_script)
|
||||
|
||||
expected_stdout = """
|
||||
CONSTANT
|
||||
=======================
|
||||
-2.488355210669293e-22
|
||||
|
||||
"""
|
||||
|
||||
@pytest.mark.version('>=2.5')
|
||||
def test_1(act_1: Action):
|
||||
act_1.expected_stdout = expected_stdout_1
|
||||
act_1.execute()
|
||||
assert act_1.clean_stdout == act_1.clean_expected_stdout
|
||||
@pytest.mark.version('>=3')
|
||||
def test_1(act: Action):
|
||||
act.expected_stdout = expected_stdout
|
||||
act.execute()
|
||||
assert act.clean_stdout == act.clean_expected_stdout
|
||||
|
||||
|
@ -1,65 +1,17 @@
|
||||
#coding:utf-8
|
||||
#
|
||||
# id: bugs.core_1366
|
||||
# title: French insensitive collation FR_FR_CI_AI
|
||||
# decription:
|
||||
# ::: NOTE :::
|
||||
# In order to check correctness of following statements under ISQL itself (NOT under fbt_run), do following:
|
||||
# 1) open some text editor that supports charset = ISO8859_1 and set encoding for new document = ISO 8859-1
|
||||
# (e.g. in Notepad++ pull-down menu: "Encoding / Character sets / Western european / ISO 8859_1")
|
||||
# 2) type commands statements that contains diacritical marks (accents) and save to .sql
|
||||
# 3) open this .sql in FAR editor and ensure that letters with diacritical marks are displayed as SINGLE characters
|
||||
# 4) run isql -i <script_encoded_in_iso8859_1.sql>
|
||||
# In order to run this script under fbt_run:
|
||||
# 1) open Notepad++ new .fbt document and set Encoding = "UTF8 without BOM"
|
||||
# 2) copy-paste text from <script_encoded_in_iso8859_1.sql>, ensure that letters with diacritical marks are readable
|
||||
# (it should be pasted here in UTF8 encoding)
|
||||
# 3) add in `expected_stdout` section required output by copy-paste from result of isql -i <script_encoded_in_iso8859_1.sql>
|
||||
# (it should be pasted here in UTF8 encoding)
|
||||
# 4) save .fbt and ensure that it was saved in UTF8 encoding, otherwise exeption like
|
||||
# "UnicodeDecodeError: 'utf8' codec can't decode byte 0xc3 in position 621: invalid continuation byte" will raise.
|
||||
#
|
||||
# 14.08.2020:
|
||||
# removed usage of generator because gen_id() result differs in FB 4.x vs previous versions since fixed core-6084.
|
||||
# Use hard-coded values for IDs.
|
||||
# Checked on:
|
||||
# 4.0.0.2151 SS: 1.672s.
|
||||
# 3.0.7.33348 SS: 0.984s.
|
||||
# 2.5.9.27150 SC: 0.277s.
|
||||
#
|
||||
# 28.02.2021
|
||||
# Changed connection charset to UTF8 otherwise on Linux this test leads to 'ERROR' with issuing:
|
||||
# ====
|
||||
# Statement failed, SQLSTATE = 42000
|
||||
# Dynamic SQL Error
|
||||
# -SQL error code = -104
|
||||
# -Token unknown - line 4, column 1
|
||||
# -e
|
||||
# Statement failed, SQLSTATE = 42000
|
||||
# Dynamic SQL Error
|
||||
# -SQL error code = -104
|
||||
# -Token unknown - line 3, column 1
|
||||
# -o
|
||||
# . . .
|
||||
# ====
|
||||
# Checked again on:
|
||||
# 1) Windows: 4.0.0.2372; 3.0.8.33416
|
||||
# 2) Linux: 4.0.0.2377
|
||||
#
|
||||
# tracker_id: CORE-1366
|
||||
# min_versions: ['2.5.0']
|
||||
# versions: 2.5
|
||||
# qmid: None
|
||||
|
||||
"""
|
||||
ID: issue-1784
|
||||
ISSUE: 1784
|
||||
TITLE: French insensitive collation FR_FR_CI_AI
|
||||
DESCRIPTION:
|
||||
JIRA: CORE-1366
|
||||
"""
|
||||
|
||||
import pytest
|
||||
from firebird.qa import db_factory, isql_act, Action
|
||||
from firebird.qa import *
|
||||
|
||||
# version: 2.5
|
||||
# resources: None
|
||||
|
||||
substitutions_1 = [('=.*', ''), ('[ \t]+', ' ')]
|
||||
|
||||
init_script_1 = """
|
||||
init_script = """
|
||||
recreate table test(id int);
|
||||
commit;
|
||||
|
||||
@ -81,27 +33,27 @@ init_script_1 = """
|
||||
commit;
|
||||
|
||||
-- http://french.about.com/od/pronunciation/a/accents.htm
|
||||
|
||||
|
||||
-- ### ONCE AGAIN ###
|
||||
-- 1) for checking this under ISQL following must be encoded in ISO8859_1
|
||||
-- 2) for running under fbt_run utility following must be encoded in UTF8.
|
||||
|
||||
|
||||
-- (cedilla) is found only on the letter "C":
|
||||
insert into test(id, cf) values( 1010, 'ç');
|
||||
|
||||
-- (acute accent) can only be on an "E"
|
||||
|
||||
-- (acute accent) can only be on an "E"
|
||||
insert into test(id, cf) values( 1020, 'é');
|
||||
|
||||
|
||||
-- (grave accent) can be found on an "A", "E", "U"
|
||||
insert into test(id, cf) values( 1030, 'à');
|
||||
insert into test(id, cf) values( 1040, 'è');
|
||||
insert into test(id, cf) values( 1050, 'ù');
|
||||
|
||||
|
||||
-- (dieresis or umlaut) can be on an E, I and U
|
||||
insert into test(id, cf) values( 1060, 'ë');
|
||||
insert into test(id, cf) values( 1070, 'ï');
|
||||
insert into test(id, cf) values( 1080, 'ü');
|
||||
|
||||
|
||||
-- (circumflex) can be on an A, E, I, O and U
|
||||
insert into test(id, cf) values( 1090, 'â');
|
||||
insert into test(id, cf) values( 1110, 'ê');
|
||||
@ -122,18 +74,18 @@ init_script_1 = """
|
||||
|
||||
"""
|
||||
|
||||
db_1 = db_factory(charset='ISO8859_1', sql_dialect=3, init=init_script_1)
|
||||
db = db_factory(charset='ISO8859_1', init=init_script)
|
||||
|
||||
test_script_1 = """
|
||||
test_script = """
|
||||
select n.id n_id, n.nf, t.cf, t.id t_id
|
||||
from noac n
|
||||
left join test t on n.nf is not distinct from t.cf
|
||||
left join test t on n.nf is not distinct from t.cf
|
||||
order by n_id, t_id;
|
||||
"""
|
||||
|
||||
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
|
||||
act = isql_act('db', test_script, substitutions=[('=.*', ''), ('[ \t]+', ' ')])
|
||||
|
||||
expected_stdout_1 = """
|
||||
expected_stdout = """
|
||||
N_ID NF CF T_ID
|
||||
============ ========== ========== ============
|
||||
1150 A à 1030
|
||||
@ -148,12 +100,12 @@ expected_stdout_1 = """
|
||||
1190 O ô 1140
|
||||
1200 U ù 1050
|
||||
1200 U ü 1080
|
||||
1200 U û 1130
|
||||
1200 U û 1130
|
||||
"""
|
||||
|
||||
@pytest.mark.version('>=2.5')
|
||||
def test_1(act_1: Action):
|
||||
act_1.expected_stdout = expected_stdout_1
|
||||
act_1.execute()
|
||||
assert act_1.clean_stdout == act_1.clean_expected_stdout
|
||||
@pytest.mark.version('>=3')
|
||||
def test_1(act: Action):
|
||||
act.expected_stdout = expected_stdout
|
||||
act.execute()
|
||||
assert act.clean_stdout == act.clean_expected_stdout
|
||||
|
||||
|
@ -1,26 +1,19 @@
|
||||
#coding:utf-8
|
||||
#
|
||||
# id: bugs.core_1371
|
||||
# title: Execute block fails within execute statement
|
||||
# decription:
|
||||
# tracker_id: CORE-1371
|
||||
# min_versions: []
|
||||
# versions: 2.0.2
|
||||
# qmid: bugs.core_1371
|
||||
|
||||
"""
|
||||
ID: issue-1789
|
||||
ISSUE: 1789
|
||||
TITLE: Execute block fails within execute statement
|
||||
DESCRIPTION:
|
||||
JIRA: CORE-1371
|
||||
"""
|
||||
|
||||
import pytest
|
||||
from firebird.qa import db_factory, isql_act, Action
|
||||
from firebird.qa import *
|
||||
|
||||
# version: 2.0.2
|
||||
# resources: None
|
||||
db = db_factory()
|
||||
|
||||
substitutions_1 = []
|
||||
|
||||
init_script_1 = """"""
|
||||
|
||||
db_1 = db_factory(sql_dialect=3, init=init_script_1)
|
||||
|
||||
test_script_1 = """set term ^;
|
||||
test_script = """set term ^;
|
||||
create procedure P
|
||||
as
|
||||
begin
|
||||
@ -31,10 +24,11 @@ set term ;^
|
||||
commit;
|
||||
"""
|
||||
|
||||
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
|
||||
|
||||
|
||||
@pytest.mark.version('>=2.0.2')
|
||||
def test_1(act_1: Action):
|
||||
act_1.execute()
|
||||
act = isql_act('db', test_script)
|
||||
|
||||
@pytest.mark.version('>=3')
|
||||
def test_1(act: Action):
|
||||
try:
|
||||
act.execute()
|
||||
except ExecutionError as e:
|
||||
pytest.fail("Test script execution failed", pytrace=False)
|
||||
|
@ -1,22 +1,17 @@
|
||||
#coding:utf-8
|
||||
#
|
||||
# id: bugs.core_1373
|
||||
# title: Incorrect result of recursive CTE query when recursive member's SELECT list contains expression using self-referenced fields
|
||||
# decription:
|
||||
# tracker_id: CORE-1373
|
||||
# min_versions: []
|
||||
# versions: 2.1
|
||||
# qmid: bugs.core_1373
|
||||
|
||||
"""
|
||||
ID: issue-1791
|
||||
ISSUE: 1791
|
||||
TITLE: Incorrect result of recursive CTE query when recursive member's SELECT list contains expression using self-referenced fields
|
||||
DESCRIPTION:
|
||||
JIRA: CORE-1373
|
||||
"""
|
||||
|
||||
import pytest
|
||||
from firebird.qa import db_factory, isql_act, Action
|
||||
from firebird.qa import *
|
||||
|
||||
# version: 2.1
|
||||
# resources: None
|
||||
|
||||
substitutions_1 = []
|
||||
|
||||
init_script_1 = """RECREATE TABLE Phases
|
||||
init_script = """RECREATE TABLE Phases
|
||||
(Id INT NOT NULL PRIMARY KEY, ParentPhaseId INT);
|
||||
|
||||
CREATE GENERATOR GenPhases;
|
||||
@ -33,9 +28,9 @@ SET GENERATOR GenPhases to 0;
|
||||
COMMIT;
|
||||
"""
|
||||
|
||||
db_1 = db_factory(sql_dialect=3, init=init_script_1)
|
||||
db = db_factory(init=init_script)
|
||||
|
||||
test_script_1 = """WITH RECURSIVE
|
||||
test_script = """WITH RECURSIVE
|
||||
Tree (OldPhaseId, OldParentPhaseId, NewPhaseId, NewParentPhaseId) AS
|
||||
(
|
||||
SELECT P.Id, P.ParentPhaseId, GEN_ID(GenPhases, 1), CAST(NULL AS INTEGER)
|
||||
@ -52,9 +47,9 @@ SELECT * FROM Tree;
|
||||
|
||||
"""
|
||||
|
||||
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
|
||||
act = isql_act('db', test_script)
|
||||
|
||||
expected_stdout_1 = """
|
||||
expected_stdout = """
|
||||
OLDPHASEID OLDPARENTPHASEID NEWPHASEID NEWPARENTPHASEID
|
||||
============ ================ ===================== ================
|
||||
491 <null> 1 <null>
|
||||
@ -65,9 +60,9 @@ expected_stdout_1 = """
|
||||
|
||||
"""
|
||||
|
||||
@pytest.mark.version('>=2.1')
|
||||
def test_1(act_1: Action):
|
||||
act_1.expected_stdout = expected_stdout_1
|
||||
act_1.execute()
|
||||
assert act_1.clean_stdout == act_1.clean_expected_stdout
|
||||
@pytest.mark.version('>=3')
|
||||
def test_1(act: Action):
|
||||
act.expected_stdout = expected_stdout
|
||||
act.execute()
|
||||
assert act.clean_stdout == act.clean_expected_stdout
|
||||
|
||||
|
@ -1,26 +1,19 @@
|
||||
#coding:utf-8
|
||||
#
|
||||
# id: bugs.core_1377
|
||||
# title: Add an ability to change role without reconnecting to database.
|
||||
# decription:
|
||||
# tracker_id:
|
||||
# min_versions: ['3.0']
|
||||
# versions: 3.0
|
||||
# qmid: bugs.core_1377
|
||||
|
||||
"""
|
||||
ID: issue-1795
|
||||
ISSUE: 1795
|
||||
TITLE: Add an ability to change role without reconnecting to database.
|
||||
DESCRIPTION:
|
||||
JIRA: CORE-1377
|
||||
"""
|
||||
|
||||
import pytest
|
||||
from firebird.qa import db_factory, isql_act, Action
|
||||
from firebird.qa import *
|
||||
|
||||
# version: 3.0
|
||||
# resources: None
|
||||
db = db_factory()
|
||||
|
||||
substitutions_1 = []
|
||||
|
||||
init_script_1 = """"""
|
||||
|
||||
db_1 = db_factory(sql_dialect=3, init=init_script_1)
|
||||
|
||||
test_script_1 = """
|
||||
test_script = """
|
||||
create role r1377a;
|
||||
create role r1377b;
|
||||
commit;
|
||||
@ -34,19 +27,19 @@ test_script_1 = """
|
||||
select current_user, current_role from rdb$database;
|
||||
"""
|
||||
|
||||
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
|
||||
act = isql_act('db', test_script)
|
||||
|
||||
expected_stdout_1 = """
|
||||
expected_stdout = """
|
||||
USER SYSDBA
|
||||
ROLE R1377A
|
||||
|
||||
|
||||
USER SYSDBA
|
||||
ROLE R1377B
|
||||
"""
|
||||
|
||||
@pytest.mark.version('>=3.0')
|
||||
def test_1(act_1: Action):
|
||||
act_1.expected_stdout = expected_stdout_1
|
||||
act_1.execute()
|
||||
assert act_1.clean_stdout == act_1.clean_expected_stdout
|
||||
def test_1(act: Action):
|
||||
act.expected_stdout = expected_stdout
|
||||
act.execute()
|
||||
assert act.clean_stdout == act.clean_expected_stdout
|
||||
|
||||
|
@ -1,157 +1,22 @@
|
||||
#coding:utf-8
|
||||
#
|
||||
# id: bugs.core_1378
|
||||
# title: Domain names and charset issues
|
||||
# decription:
|
||||
# 05-mar-2021. Re-implemented in order to have ability to run this test on Linux.
|
||||
# Test encodes to UTF8 all needed statements (SET NAMES; CONNECT; DDL and DML) and stores this text in .sql file.
|
||||
# NOTE: 'SET NAMES' contain character set that must be used for reproducing problem (WIN1251 in this test).
|
||||
# Then ISQL is launched in separate (child) process which performs all necessary actions (using required charset).
|
||||
# Result will be redirected to log(s) which will be opened further via codecs.open(...encoding='cp1251').
|
||||
# Finally, its content will be converted to UTF8 for showing in expected_stdout.
|
||||
# Checked on:
|
||||
# * Windows: 4.0.0.2377, 3.0.8.33423; 2.5.9.27152
|
||||
# * Linux: 4.0.0.2379, 3.0.8.33415
|
||||
#
|
||||
# tracker_id:
|
||||
# min_versions: ['2.5.9']
|
||||
# versions: 2.5.9
|
||||
# qmid: bugs.core_1378
|
||||
|
||||
"""
|
||||
ID: issue-1796
|
||||
ISSUE: 1796
|
||||
TITLE: Domain names and charset issues
|
||||
DESCRIPTION:
|
||||
JIRA: CORE-1378
|
||||
"""
|
||||
|
||||
import pytest
|
||||
from firebird.qa import db_factory, python_act, Action, temp_file
|
||||
from firebird.qa import *
|
||||
from pathlib import Path
|
||||
|
||||
# version: 2.5.9
|
||||
# resources: None
|
||||
db = db_factory(charset='WIN1251')
|
||||
|
||||
substitutions_1 = []
|
||||
act = python_act('db')
|
||||
|
||||
init_script_1 = """"""
|
||||
|
||||
db_1 = db_factory(charset='WIN1251', sql_dialect=3, init=init_script_1)
|
||||
|
||||
# test_script_1
|
||||
#---
|
||||
#
|
||||
# import os
|
||||
# import codecs
|
||||
# import subprocess
|
||||
# import time
|
||||
# engine = db_conn.engine_version
|
||||
# db_conn.close()
|
||||
#
|
||||
# #--------------------------------------------
|
||||
#
|
||||
# def flush_and_close( file_handle ):
|
||||
# # https://docs.python.org/2/library/os.html#os.fsync
|
||||
# # If you're starting with a Python file object f,
|
||||
# # first do f.flush(), and
|
||||
# # then do os.fsync(f.fileno()), to ensure that all internal buffers associated with f are written to disk.
|
||||
# global os
|
||||
#
|
||||
# file_handle.flush()
|
||||
# if file_handle.mode not in ('r', 'rb') and file_handle.name != os.devnull:
|
||||
# # otherwise: "OSError: [Errno 9] Bad file descriptor"!
|
||||
# os.fsync(file_handle.fileno())
|
||||
# file_handle.close()
|
||||
#
|
||||
# #--------------------------------------------
|
||||
#
|
||||
# def cleanup( f_names_list ):
|
||||
# global os
|
||||
# for i in range(len( f_names_list )):
|
||||
# if type(f_names_list[i]) == file:
|
||||
# del_name = f_names_list[i].name
|
||||
# elif type(f_names_list[i]) == str:
|
||||
# del_name = f_names_list[i]
|
||||
# else:
|
||||
# print('Unrecognized type of element:', f_names_list[i], ' - can not be treated as file.')
|
||||
# del_name = None
|
||||
#
|
||||
# if del_name and os.path.isfile( del_name ):
|
||||
# os.remove( del_name )
|
||||
#
|
||||
# #--------------------------------------------
|
||||
#
|
||||
# sql_txt=''' set bail on;
|
||||
# set names win1251;
|
||||
# connect '%(dsn)s' user '%(user_name)s' password '%(user_password)s';
|
||||
#
|
||||
# create collation "вид прописи" for win1251 from pxw_cyrl pad space case insensitive accent insensitive;
|
||||
# commit;
|
||||
# create domain "значение числа" as int;
|
||||
# create domain "число прописью" as varchar(8191) character set win1251 collate "вид прописи";
|
||||
# commit;
|
||||
# create table test( id "значение числа", txt "число прописью");
|
||||
# commit;
|
||||
# set term ^;
|
||||
# create procedure sp_test ( i_number "значение числа") returns( o_text "число прописью") as
|
||||
# begin
|
||||
# suspend;
|
||||
# end
|
||||
# ^
|
||||
# set term ;^
|
||||
# commit;
|
||||
#
|
||||
# --set blob all;
|
||||
# --select rdb$procedure_source as rdb_source_blob_id from rdb$procedures where rdb$procedure_name = upper('sp_test');
|
||||
# set list on;
|
||||
#
|
||||
# select rdb$procedure_name from rdb$procedures where rdb$procedure_name = upper('sp_test');
|
||||
#
|
||||
# select
|
||||
# p.rdb$parameter_name
|
||||
# ,p.rdb$field_source
|
||||
# ,f.rdb$field_type
|
||||
# ,f.rdb$field_sub_type
|
||||
# ,f.rdb$field_length
|
||||
# ,f.rdb$character_length
|
||||
# ,f.rdb$character_set_id
|
||||
# ,f.rdb$collation_id
|
||||
# ,c.rdb$character_set_name
|
||||
# ,s.rdb$collation_name
|
||||
# from rdb$procedure_parameters p
|
||||
# left join rdb$fields f on p.rdb$field_source = f.rdb$field_name
|
||||
# left join rdb$character_sets c on f.rdb$character_set_id = c.rdb$character_set_id
|
||||
# left join rdb$collations s on
|
||||
# f.rdb$collation_id = s.rdb$collation_id
|
||||
# and c.rdb$character_set_id = s.rdb$character_set_id
|
||||
# where rdb$procedure_name = upper('sp_test')
|
||||
# ;
|
||||
#
|
||||
#
|
||||
# ''' % dict(globals(), **locals())
|
||||
#
|
||||
# f_run_sql = open( os.path.join(context['temp_directory'], 'tmp_1378_win1251.sql'), 'w' )
|
||||
# f_run_sql.write( sql_txt.decode('utf8').encode('cp1251') )
|
||||
# flush_and_close( f_run_sql )
|
||||
#
|
||||
# # result: file tmp_1378_win1251.sql is encoded in win1251
|
||||
#
|
||||
# f_run_log = open( os.path.splitext(f_run_sql.name)[0]+'.log', 'w')
|
||||
# subprocess.call( [ context['isql_path'], '-q', '-i', f_run_sql.name ],
|
||||
# stdout = f_run_log,
|
||||
# stderr = subprocess.STDOUT
|
||||
# )
|
||||
# flush_and_close( f_run_log ) # result: output will be encoded in win1251
|
||||
#
|
||||
# with codecs.open(f_run_log.name, 'r', encoding='cp1251' ) as f:
|
||||
# result_in_win1251 = f.readlines()
|
||||
#
|
||||
# for i in result_in_win1251:
|
||||
# print( i.encode('utf8') )
|
||||
#
|
||||
# # cleanup:
|
||||
# ###########
|
||||
# cleanup( (f_run_sql, f_run_log) )
|
||||
#
|
||||
#
|
||||
#---
|
||||
|
||||
act_1 = python_act('db_1', substitutions=substitutions_1)
|
||||
|
||||
tmp_file_1 = temp_file('non_ascii_ddl.sql')
|
||||
tmp_file = temp_file('non_ascii_ddl.sql')
|
||||
|
||||
sql_txt = '''
|
||||
set bail on;
|
||||
@ -198,7 +63,7 @@ left join rdb$collations s on
|
||||
where rdb$procedure_name = upper('sp_test');
|
||||
'''
|
||||
|
||||
expected_stdout_1 = """
|
||||
expected_stdout = """
|
||||
RDB$PROCEDURE_NAME SP_TEST
|
||||
RDB$PARAMETER_NAME I_NUMBER
|
||||
RDB$FIELD_SOURCE значение числа
|
||||
@ -222,11 +87,11 @@ expected_stdout_1 = """
|
||||
RDB$COLLATION_NAME вид прописи
|
||||
"""
|
||||
|
||||
@pytest.mark.version('>=2.5.9')
|
||||
def test_1(act_1: Action, tmp_file_1: Path):
|
||||
tmp_file_1.write_bytes(sql_txt.encode('cp1251'))
|
||||
act_1.expected_stdout = expected_stdout_1
|
||||
act_1.isql(switches=['-q'], input_file=tmp_file_1, charset='win1251', io_enc='cp1251')
|
||||
assert act_1.clean_stdout == act_1.clean_expected_stdout
|
||||
@pytest.mark.version('>=3')
|
||||
def test_1(act: Action, tmp_file: Path):
|
||||
tmp_file.write_bytes(sql_txt.encode('cp1251'))
|
||||
act.expected_stdout = expected_stdout
|
||||
act.isql(switches=['-q'], input_file=tmp_file, charset='win1251', io_enc='cp1251')
|
||||
assert act.clean_stdout == act.clean_expected_stdout
|
||||
|
||||
|
||||
|
@ -1,26 +1,19 @@
|
||||
#coding:utf-8
|
||||
#
|
||||
# id: bugs.core_1379
|
||||
# title: Invalid parameter type when using it in CHAR_LENGTH function
|
||||
# decription:
|
||||
# tracker_id:
|
||||
# min_versions: ['2.5.0']
|
||||
# versions: 2.5
|
||||
# qmid: bugs.core_1379
|
||||
|
||||
"""
|
||||
ID: issue-1797
|
||||
ISSUE: 1797
|
||||
TITLE: Invalid parameter type when using it in CHAR_LENGTH function
|
||||
DESCRIPTION:
|
||||
JIRA: CORE-1379
|
||||
"""
|
||||
|
||||
import pytest
|
||||
from firebird.qa import db_factory, isql_act, Action
|
||||
from firebird.qa import *
|
||||
|
||||
# version: 2.5
|
||||
# resources: None
|
||||
db = db_factory()
|
||||
|
||||
substitutions_1 = [('-At block line: [\\d]+, col: [\\d]+', '-At block line')]
|
||||
|
||||
init_script_1 = """"""
|
||||
|
||||
db_1 = db_factory(sql_dialect=3, init=init_script_1)
|
||||
|
||||
test_script_1 = """
|
||||
test_script = """
|
||||
set list on;
|
||||
set term ^;
|
||||
execute block returns(r int) as
|
||||
@ -43,15 +36,15 @@ test_script_1 = """
|
||||
end
|
||||
^
|
||||
set term ;^
|
||||
-- 05.05.2015:
|
||||
-- 05.05.2015:
|
||||
-- 1) changed min version to 2.5 (according to ticket header info; output in 2.5 and 3.0 now fully matches)
|
||||
-- 2) removed STDOUT (for the first ES);
|
||||
-- 3) changed expected STDERR: all three ES must now raise exception 'Data type unknown'.
|
||||
"""
|
||||
|
||||
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
|
||||
act = isql_act('db', test_script, substitutions=[('-At block line: [\\d]+, col: [\\d]+', '-At block line')])
|
||||
|
||||
expected_stderr_1 = """
|
||||
expected_stderr = """
|
||||
Statement failed, SQLSTATE = HY004
|
||||
Dynamic SQL Error
|
||||
-SQL error code = -804
|
||||
@ -71,9 +64,9 @@ expected_stderr_1 = """
|
||||
-At block line: 3, col: 9
|
||||
"""
|
||||
|
||||
@pytest.mark.version('>=2.5')
|
||||
def test_1(act_1: Action):
|
||||
act_1.expected_stderr = expected_stderr_1
|
||||
act_1.execute()
|
||||
assert act_1.clean_stderr == act_1.clean_expected_stderr
|
||||
@pytest.mark.version('>=3')
|
||||
def test_1(act: Action):
|
||||
act.expected_stderr = expected_stderr
|
||||
act.execute()
|
||||
assert act.clean_stderr == act.clean_expected_stderr
|
||||
|
||||
|
@ -1,35 +1,17 @@
|
||||
#coding:utf-8
|
||||
#
|
||||
# id: bugs.core_1384
|
||||
# title: LIKE doesn't work correctly with collations using SPECIALS-FIRST=1
|
||||
# decription:
|
||||
# 02-mar-2021. Re-implemented in ordeer to have ability to run this test on Linux.
|
||||
# We run 'init_script' using charset = utf8 but then run separate ISQL-process
|
||||
# with request to establish connection using charset = ISO8859_1.
|
||||
#
|
||||
# *** NOTE ***
|
||||
# Script that must be executed by ISQL does NOT contain any non-ascii characters.
|
||||
# Query with diacritical symbols was moved into view V_TEST which is created in init_script
|
||||
# using charset ***UTF-8*** (otherwise is seems to be unable to run this test on Linux).
|
||||
#
|
||||
# Checked on:
|
||||
# * Windows: 4.0.0.2377, 3.0.8.33420, 2.5.9.27152
|
||||
# * Linux: 4.0.0.2377, 3.0.8.33415
|
||||
#
|
||||
# tracker_id: CORE-1384
|
||||
# min_versions: ['2.1.7']
|
||||
# versions: 2.1.7
|
||||
# qmid: None
|
||||
|
||||
"""
|
||||
ID: issue-1802
|
||||
ISSUE: 1802
|
||||
TITLE: LIKE doesn't work correctly with collations using SPECIALS-FIRST=1
|
||||
DESCRIPTION:
|
||||
JIRA: CORE-1384
|
||||
"""
|
||||
|
||||
import pytest
|
||||
from firebird.qa import db_factory, isql_act, Action
|
||||
from firebird.qa import *
|
||||
|
||||
# version: 2.1.7
|
||||
# resources: None
|
||||
|
||||
substitutions_1 = []
|
||||
|
||||
init_script_1 = """
|
||||
init_script = """
|
||||
create collation coll_es for iso8859_1 from external ('ES_ES_CI_AI') 'SPECIALS-FIRST=1';
|
||||
create collation coll_fr for iso8859_1 from external ('FR_FR') CASE INSENSITIVE accent insensitive 'SPECIALS-FIRST=1';
|
||||
commit;
|
||||
@ -47,33 +29,17 @@ init_script_1 = """
|
||||
;
|
||||
"""
|
||||
|
||||
db_1 = db_factory(charset='UTF8', sql_dialect=3, init=init_script_1)
|
||||
db = db_factory(charset='UTF8', init=init_script)
|
||||
|
||||
# test_script_1
|
||||
#---
|
||||
#
|
||||
# sql_cmd='''
|
||||
# set names ISO8859_1;
|
||||
# connect '%(dsn)s' user '%(user_name)s' password '%(user_password)s';
|
||||
# set list on;
|
||||
# show collation;
|
||||
# select * from v_test;
|
||||
# ''' % dict(globals(), **locals())
|
||||
#
|
||||
# runProgram( 'isql', [ '-q' ], sql_cmd)
|
||||
#
|
||||
#
|
||||
#---
|
||||
|
||||
test_script_1 = """
|
||||
test_script = """
|
||||
set list on;
|
||||
show collation;
|
||||
select * from v_test;
|
||||
"""
|
||||
|
||||
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
|
||||
act = isql_act('db', test_script)
|
||||
|
||||
expected_stdout_1 = """
|
||||
expected_stdout = """
|
||||
COLL_ES, CHARACTER SET ISO8859_1, FROM EXTERNAL ('ES_ES_CI_AI'), 'SPECIALS-FIRST=1'
|
||||
COLL_FR, CHARACTER SET ISO8859_1, FROM EXTERNAL ('FR_FR'), CASE INSENSITIVE, ACCENT INSENSITIVE, 'SPECIALS-FIRST=1'
|
||||
RESULT_FOR_ES_CI_AI 0
|
||||
@ -82,10 +48,10 @@ expected_stdout_1 = """
|
||||
RESULT_FOR_FR_CI_AI 0
|
||||
"""
|
||||
|
||||
@pytest.mark.version('>=2.1.7')
|
||||
def test_1(act_1: Action):
|
||||
act_1.expected_stdout = expected_stdout_1
|
||||
act_1.execute(charset='ISO8859_1')
|
||||
assert act_1.clean_stdout == act_1.clean_expected_stdout
|
||||
@pytest.mark.version('>=3')
|
||||
def test_1(act: Action):
|
||||
act.expected_stdout = expected_stdout
|
||||
act.execute(charset='ISO8859_1')
|
||||
assert act.clean_stdout == act.clean_expected_stdout
|
||||
|
||||
|
||||
|
@ -1,26 +1,19 @@
|
||||
#coding:utf-8
|
||||
#
|
||||
# id: bugs.core_1386
|
||||
# title: Generated columns
|
||||
# decription:
|
||||
# tracker_id: CORE-1386
|
||||
# min_versions: []
|
||||
# versions: 2.1.0
|
||||
# qmid: bugs.core_1386
|
||||
|
||||
"""
|
||||
ID: issue-1804
|
||||
ISSUE: 1804
|
||||
TITLE: Generated columns
|
||||
DESCRIPTION:
|
||||
JIRA: CORE-1386
|
||||
"""
|
||||
|
||||
import pytest
|
||||
from firebird.qa import db_factory, isql_act, Action
|
||||
from firebird.qa import *
|
||||
|
||||
# version: 2.1.0
|
||||
# resources: None
|
||||
db = db_factory()
|
||||
|
||||
substitutions_1 = []
|
||||
|
||||
init_script_1 = """"""
|
||||
|
||||
db_1 = db_factory(sql_dialect=3, init=init_script_1)
|
||||
|
||||
test_script_1 = """CREATE TABLE TAB1 (COL1 INTEGER, COL2 GENERATED ALWAYS AS (COL1 +1), COL3 INTEGER GENERATED ALWAYS AS (COL1 +1));
|
||||
test_script = """CREATE TABLE TAB1 (COL1 INTEGER, COL2 GENERATED ALWAYS AS (COL1 +1), COL3 INTEGER GENERATED ALWAYS AS (COL1 +1));
|
||||
COMMIT;
|
||||
SHOW TABLE TAB1;
|
||||
INSERT INTO TAB1 (COL1) VALUES (1);
|
||||
@ -29,9 +22,9 @@ SELECT * FROM TAB1;
|
||||
|
||||
"""
|
||||
|
||||
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
|
||||
act = isql_act('db', test_script)
|
||||
|
||||
expected_stdout_1 = """COL1 INTEGER Nullable
|
||||
expected_stdout = """COL1 INTEGER Nullable
|
||||
COL2 Computed by: (COL1 +1)
|
||||
COL3 Computed by: (COL1 +1)
|
||||
|
||||
@ -41,9 +34,9 @@ COL3 Computed by: (COL1 +1)
|
||||
|
||||
"""
|
||||
|
||||
@pytest.mark.version('>=2.1.0')
|
||||
def test_1(act_1: Action):
|
||||
act_1.expected_stdout = expected_stdout_1
|
||||
act_1.execute()
|
||||
assert act_1.clean_stdout == act_1.clean_expected_stdout
|
||||
@pytest.mark.version('>=3')
|
||||
def test_1(act: Action):
|
||||
act.expected_stdout = expected_stdout
|
||||
act.execute()
|
||||
assert act.clean_stdout == act.clean_expected_stdout
|
||||
|
||||
|
@ -1,44 +1,18 @@
|
||||
#coding:utf-8
|
||||
#
|
||||
# id: bugs.core_1389
|
||||
# title: Indexed MIN/MAX aggregates produce three index reads instead of the expected one indexed read
|
||||
# decription:
|
||||
# We use API call db_info(fdb.isc_info_read_idx_count) for obtaining number of indexed reads and
|
||||
# extract their values which are reported per table and are cumulative since start of attachment.
|
||||
# Four statements are used for analyzing (table have all needed indexes):
|
||||
# * select max(x) from ...;
|
||||
# * select x from ... order by x asc rows 1;
|
||||
# * select min(y) from ...;
|
||||
# * select y from ... order by y desc rows 1;
|
||||
#
|
||||
# All of them must take only one indexed read.
|
||||
#
|
||||
# Info about 'isc_info_read_idx_count':
|
||||
# Number of indexed database reads <...>
|
||||
# Reported per table.
|
||||
# Calculated since the current database attachment started // CUMULATIVE!
|
||||
#
|
||||
# See also:
|
||||
# http://pythonhosted.org/fdb/reference.html#fdb.Connection.database_info
|
||||
#
|
||||
# Confirmed bug on WI-V2.0.0.12724: db_info() received 3 (three) indexed reads instead of 1 for queries:
|
||||
# 'select min(...) from ...' and 'select max(...) from ...'
|
||||
#
|
||||
# tracker_id: CORE-1389
|
||||
# min_versions: ['2.5.0']
|
||||
# versions: 2.5
|
||||
# qmid: None
|
||||
|
||||
"""
|
||||
ID: issue-1807
|
||||
ISSUE: 1807
|
||||
TITLE: Indexed MIN/MAX aggregates produce three index reads instead of the expected one indexed read
|
||||
DESCRIPTION:
|
||||
JIRA: CORE-1389
|
||||
"""
|
||||
|
||||
import pytest
|
||||
from firebird.qa import db_factory, python_act, Action
|
||||
from firebird.qa import *
|
||||
from firebird.driver import DbInfoCode
|
||||
|
||||
# version: 2.5
|
||||
# resources: None
|
||||
|
||||
substitutions_1 = []
|
||||
|
||||
init_script_1 = """
|
||||
init_script = """
|
||||
recreate table test(x int, y int);
|
||||
commit;
|
||||
insert into test(x, y)
|
||||
@ -50,54 +24,19 @@ init_script_1 = """
|
||||
commit;
|
||||
"""
|
||||
|
||||
db_1 = db_factory(sql_dialect=3, init=init_script_1)
|
||||
db = db_factory(init=init_script)
|
||||
|
||||
# test_script_1
|
||||
#---
|
||||
# import fdb
|
||||
# sql_get_rel_id="select rdb$relation_id from rdb$relations where trim(rdb$relation_name)=upper('test')"
|
||||
#
|
||||
# cur=db_conn.cursor()
|
||||
# cur.execute(sql_get_rel_id)
|
||||
#
|
||||
# test_rel=-1
|
||||
# for r in cur:
|
||||
# test_rel=r[0]
|
||||
#
|
||||
# sql_set=[
|
||||
# 'select min(x) from test',
|
||||
# 'select x from test order by x rows 1',
|
||||
# 'select max(y) from test',
|
||||
# 'select y from test order by y desc rows 1'
|
||||
# ]
|
||||
#
|
||||
# v_previous_idx_counter=0
|
||||
# for i in range(0,len(sql_set)):
|
||||
# cur.execute(sql_set[i])
|
||||
# for r in cur:
|
||||
# y=r[0]
|
||||
#
|
||||
# info = db_conn.db_info(fdb.isc_info_read_idx_count)
|
||||
# # WI-V2.0.0.12724
|
||||
# for k,v_cumulative_idx_counter in info.items():
|
||||
# if k == test_rel:
|
||||
# print( 'Number of indexed reads: ' + str(v_cumulative_idx_counter - v_previous_idx_counter) )
|
||||
# v_previous_idx_counter = v_cumulative_idx_counter
|
||||
# cur.close()
|
||||
#
|
||||
#---
|
||||
act = python_act('db')
|
||||
|
||||
act_1 = python_act('db_1', substitutions=substitutions_1)
|
||||
|
||||
expected_stdout_1 = """Number of indexed reads: 1
|
||||
expected_stdout = """Number of indexed reads: 1
|
||||
Number of indexed reads: 1
|
||||
Number of indexed reads: 1
|
||||
Number of indexed reads: 1
|
||||
"""
|
||||
|
||||
@pytest.mark.version('>=2.5')
|
||||
def test_1(act_1: Action, capsys):
|
||||
with act_1.db.connect() as con:
|
||||
@pytest.mark.version('>=3')
|
||||
def test_1(act: Action, capsys):
|
||||
with act.db.connect() as con:
|
||||
c = con.cursor()
|
||||
c.execute("select rdb$relation_id from rdb$relations where trim(rdb$relation_name)=upper('test')")
|
||||
test_rel = c.fetchone()[0]
|
||||
@ -116,4 +55,4 @@ def test_1(act_1: Action, capsys):
|
||||
previous_idx_counter = cumulative_idx_counter
|
||||
#
|
||||
output = capsys.readouterr()
|
||||
assert output.out == expected_stdout_1
|
||||
assert output.out == expected_stdout
|
||||
|
@ -1,44 +1,39 @@
|
||||
#coding:utf-8
|
||||
#
|
||||
# id: bugs.core_1395
|
||||
# title: Few problems with domains's check constraints
|
||||
# decription:
|
||||
# tracker_id: CORE-1395
|
||||
# min_versions: []
|
||||
# versions: 2.5
|
||||
# qmid: bugs.core_1395-250
|
||||
|
||||
"""
|
||||
ID: issue-1813
|
||||
ISSUE: 1813
|
||||
TITLE: Few problems with domains's check constraints
|
||||
DESCRIPTION:
|
||||
JIRA: CORE-1395
|
||||
"""
|
||||
|
||||
import pytest
|
||||
from firebird.qa import db_factory, isql_act, Action
|
||||
from firebird.qa import *
|
||||
|
||||
# version: 2.5
|
||||
# resources: None
|
||||
|
||||
substitutions_1 = []
|
||||
|
||||
init_script_1 = """CREATE TABLE TEST ( ID INTEGER );
|
||||
init_script = """CREATE TABLE TEST ( ID INTEGER );
|
||||
CREATE DOMAIN TEST_DOMAIN AS INTEGER CHECK (EXISTS(SELECT * FROM TEST WHERE ID=VALUE));
|
||||
"""
|
||||
|
||||
db_1 = db_factory(sql_dialect=3, init=init_script_1)
|
||||
db = db_factory(init=init_script)
|
||||
|
||||
test_script_1 = """DROP TABLE TEST;
|
||||
test_script = """DROP TABLE TEST;
|
||||
COMMIT;
|
||||
|
||||
"""
|
||||
|
||||
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
|
||||
act = isql_act('db', test_script)
|
||||
|
||||
expected_stderr_1 = """Statement failed, SQLSTATE = 42000
|
||||
expected_stderr = """Statement failed, SQLSTATE = 42000
|
||||
unsuccessful metadata update
|
||||
-cannot delete
|
||||
-COLUMN TEST.ID
|
||||
-there are 1 dependencies
|
||||
"""
|
||||
|
||||
@pytest.mark.version('>=2.5')
|
||||
def test_1(act_1: Action):
|
||||
act_1.expected_stderr = expected_stderr_1
|
||||
act_1.execute()
|
||||
assert act_1.clean_stderr == act_1.clean_expected_stderr
|
||||
@pytest.mark.version('>=3')
|
||||
def test_1(act: Action):
|
||||
act.expected_stderr = expected_stderr
|
||||
act.execute()
|
||||
assert act.clean_stderr == act.clean_expected_stderr
|
||||
|
||||
|
@ -1,26 +1,19 @@
|
||||
#coding:utf-8
|
||||
#
|
||||
# id: bugs.core_1401
|
||||
# title: Global temporary table instance may pick up not all indices
|
||||
# decription:
|
||||
# tracker_id: CORE-1401
|
||||
# min_versions: []
|
||||
# versions: 2.1
|
||||
# qmid: bugs.core_1401
|
||||
|
||||
"""
|
||||
ID: issue-1819
|
||||
ISSUE: 1819
|
||||
TITLE: Global temporary table instance may pick up not all indices
|
||||
DESCRIPTION:
|
||||
JIRA: CORE-1401
|
||||
"""
|
||||
|
||||
import pytest
|
||||
from firebird.qa import db_factory, isql_act, Action
|
||||
from firebird.qa import *
|
||||
|
||||
# version: 2.1
|
||||
# resources: None
|
||||
db = db_factory()
|
||||
|
||||
substitutions_1 = []
|
||||
|
||||
init_script_1 = """"""
|
||||
|
||||
db_1 = db_factory(sql_dialect=3, init=init_script_1)
|
||||
|
||||
test_script_1 = """create global temporary table t (f1 int, f2 int, f3 int);
|
||||
test_script = """create global temporary table t (f1 int, f2 int, f3 int);
|
||||
create index idx1 on t (f1);
|
||||
create index idx2 on t (f2);
|
||||
create index idx3 on t (f3);
|
||||
@ -33,9 +26,9 @@ select * from t where f2 = 1;
|
||||
select * from t where f3 = 1;
|
||||
"""
|
||||
|
||||
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
|
||||
act = isql_act('db', test_script)
|
||||
|
||||
expected_stdout_1 = """
|
||||
expected_stdout = """
|
||||
PLAN (T INDEX (IDX1))
|
||||
|
||||
F1 F2 F3
|
||||
@ -58,9 +51,9 @@ PLAN (T INDEX (IDX3))
|
||||
|
||||
"""
|
||||
|
||||
@pytest.mark.version('>=2.1')
|
||||
def test_1(act_1: Action):
|
||||
act_1.expected_stdout = expected_stdout_1
|
||||
act_1.execute()
|
||||
assert act_1.clean_stdout == act_1.clean_expected_stdout
|
||||
@pytest.mark.version('>=3')
|
||||
def test_1(act: Action):
|
||||
act.expected_stdout = expected_stdout
|
||||
act.execute()
|
||||
assert act.clean_stdout == act.clean_expected_stdout
|
||||
|
||||
|
@ -1,47 +1,40 @@
|
||||
#coding:utf-8
|
||||
#
|
||||
# id: bugs.core_1402
|
||||
# title: CREATE VIEW without column list when UNION is used
|
||||
# decription:
|
||||
# tracker_id: CORE-1402
|
||||
# min_versions: ['2.5.0']
|
||||
# versions: 2.5.0
|
||||
# qmid: None
|
||||
|
||||
"""
|
||||
ID: issue-1820
|
||||
ISSUE: 1820
|
||||
TITLE: CREATE VIEW without column list when UNION is used
|
||||
DESCRIPTION:
|
||||
JIRA: CORE-1402
|
||||
"""
|
||||
|
||||
import pytest
|
||||
from firebird.qa import db_factory, isql_act, Action
|
||||
from firebird.qa import *
|
||||
|
||||
# version: 2.5.0
|
||||
# resources: None
|
||||
db = db_factory()
|
||||
|
||||
substitutions_1 = [('V_SOURCE.*', '')]
|
||||
|
||||
init_script_1 = """"""
|
||||
|
||||
db_1 = db_factory(page_size=4096, sql_dialect=3, init=init_script_1)
|
||||
|
||||
test_script_1 = """
|
||||
test_script = """
|
||||
recreate view V1 as
|
||||
select d.rdb$relation_id from rdb$database d
|
||||
union all
|
||||
select d.rdb$relation_id from rdb$database d;
|
||||
|
||||
|
||||
recreate view V2 as
|
||||
select d.rdb$relation_id as q from rdb$database d
|
||||
union all
|
||||
select d.rdb$relation_id as w from rdb$database d;
|
||||
|
||||
|
||||
recreate view V3 as
|
||||
select a from (select 1 a from rdb$database)
|
||||
union all
|
||||
select b from (select 1 b from rdb$database);
|
||||
|
||||
|
||||
recreate view V4 as
|
||||
select a as a1 from (select 1 a from rdb$database)
|
||||
union all
|
||||
select b as b1 from (select 1 b from rdb$database);
|
||||
commit;
|
||||
|
||||
|
||||
set blob all;
|
||||
set list on;
|
||||
|
||||
@ -61,9 +54,9 @@ test_script_1 = """
|
||||
order by v_name, f_name;
|
||||
"""
|
||||
|
||||
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
|
||||
act = isql_act('db', test_script, substitutions=[('V_SOURCE.*', '')])
|
||||
|
||||
expected_stdout_1 = """
|
||||
expected_stdout = """
|
||||
V_NAME V1
|
||||
V_SOURCE 6:1e8
|
||||
select d.rdb$relation_id from rdb$database d
|
||||
@ -71,7 +64,7 @@ expected_stdout_1 = """
|
||||
select d.rdb$relation_id from rdb$database d
|
||||
F_NAME RDB$RELATION_ID
|
||||
F_TYPE 7
|
||||
|
||||
|
||||
V_NAME V2
|
||||
V_SOURCE 6:1eb
|
||||
select d.rdb$relation_id as q from rdb$database d
|
||||
@ -79,7 +72,7 @@ expected_stdout_1 = """
|
||||
select d.rdb$relation_id as w from rdb$database d
|
||||
F_NAME Q
|
||||
F_TYPE 7
|
||||
|
||||
|
||||
V_NAME V3
|
||||
V_SOURCE 6:2ce
|
||||
select a from (select 1 a from rdb$database)
|
||||
@ -87,7 +80,7 @@ expected_stdout_1 = """
|
||||
select b from (select 1 b from rdb$database)
|
||||
F_NAME A
|
||||
F_TYPE 8
|
||||
|
||||
|
||||
V_NAME V4
|
||||
V_SOURCE 6:2d1
|
||||
select a as a1 from (select 1 a from rdb$database)
|
||||
@ -97,9 +90,9 @@ expected_stdout_1 = """
|
||||
F_TYPE 8
|
||||
"""
|
||||
|
||||
@pytest.mark.version('>=2.5.0')
|
||||
def test_1(act_1: Action):
|
||||
act_1.expected_stdout = expected_stdout_1
|
||||
act_1.execute()
|
||||
assert act_1.clean_stdout == act_1.clean_expected_stdout
|
||||
@pytest.mark.version('>=3')
|
||||
def test_1(act: Action):
|
||||
act.expected_stdout = expected_stdout
|
||||
act.execute()
|
||||
assert act.clean_stdout == act.clean_expected_stdout
|
||||
|
||||
|
@ -1,22 +1,17 @@
|
||||
#coding:utf-8
|
||||
#
|
||||
# id: bugs.core_1409
|
||||
# title: Support for autonomous transactions
|
||||
# decription:
|
||||
# tracker_id: CORE-1409
|
||||
# min_versions: ['2.5.0']
|
||||
# versions: 2.5.0
|
||||
# qmid: None
|
||||
|
||||
"""
|
||||
ID: issue-1827
|
||||
ISSUE: 1827
|
||||
TITLE: Support for autonomous transactions
|
||||
DESCRIPTION:
|
||||
JIRA: CORE-1409
|
||||
"""
|
||||
|
||||
import pytest
|
||||
from firebird.qa import db_factory, isql_act, Action
|
||||
from firebird.qa import *
|
||||
|
||||
# version: 2.5.0
|
||||
# resources: None
|
||||
|
||||
substitutions_1 = []
|
||||
|
||||
init_script_1 = """create table log (
|
||||
init_script = """create table log (
|
||||
msg varchar(60)
|
||||
);
|
||||
commit;
|
||||
@ -39,24 +34,23 @@ set term ;!
|
||||
commit;
|
||||
"""
|
||||
|
||||
db_1 = db_factory(page_size=4096, sql_dialect=3, init=init_script_1)
|
||||
db = db_factory(init=init_script)
|
||||
|
||||
test_script_1 = """select msg from log;
|
||||
test_script = """select msg from log;
|
||||
"""
|
||||
|
||||
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
|
||||
act = isql_act('db', test_script)
|
||||
|
||||
expected_stdout_1 = """Database: localhost:C:\\fbtest2\\tmp\\bugs.core_1409.fdb, User: SYSDBA
|
||||
SQL>
|
||||
expected_stdout = """
|
||||
MSG
|
||||
============================================================
|
||||
SYSDBA connected
|
||||
|
||||
SQL>"""
|
||||
"""
|
||||
|
||||
@pytest.mark.version('>=2.5.0')
|
||||
def test_1(act_1: Action):
|
||||
act_1.expected_stdout = expected_stdout_1
|
||||
act_1.execute()
|
||||
assert act_1.clean_stdout == act_1.clean_expected_stdout
|
||||
@pytest.mark.version('>=3')
|
||||
def test_1(act: Action):
|
||||
act.expected_stdout = expected_stdout
|
||||
act.execute()
|
||||
assert act.clean_stdout == act.clean_expected_stdout
|
||||
|
||||
|
@ -1,22 +1,23 @@
|
||||
#coding:utf-8
|
||||
#
|
||||
# id: bugs.core_1419
|
||||
# title: Wrong current timestamp evaluation for selectable procedures
|
||||
# decription: In our implementation, CURRENT_DATE/TIME[STAMP] values are evaluated at the request (aka SQL statement) start time and are permanent for the duration of that request. This rule includes the nested calls (procedures and triggers) as well, i.e. they inherit the parent's timestamp, thus providing the stable date-time value for the entire call stack. However, this rule is broken for selectable procedures that evaluate current date-time values at every invocation.
|
||||
# tracker_id: CORE-1419
|
||||
# min_versions: []
|
||||
# versions: 3.0
|
||||
# qmid: bugs.core_1419
|
||||
|
||||
"""
|
||||
ID: issue-1837
|
||||
ISSUE: 1837
|
||||
TITLE: Wrong current timestamp evaluation for selectable procedures
|
||||
DESCRIPTION:
|
||||
In our implementation, CURRENT_DATE/TIME[STAMP] values are evaluated at the request
|
||||
(aka SQL statement) start time and are permanent for the duration of that request.
|
||||
This rule includes the nested calls (procedures and triggers) as well, i.e. they inherit
|
||||
the parent's timestamp, thus providing the stable date-time value for the entire call stack.
|
||||
However, this rule is broken for selectable procedures that evaluate current date-time
|
||||
values at every invocation.
|
||||
JIRA: CORE-1419
|
||||
"""
|
||||
|
||||
import pytest
|
||||
from firebird.qa import db_factory, isql_act, Action
|
||||
from firebird.qa import *
|
||||
|
||||
# version: 3.0
|
||||
# resources: None
|
||||
|
||||
substitutions_1 = []
|
||||
|
||||
init_script_1 = """set term ^;
|
||||
init_script = """set term ^;
|
||||
|
||||
create procedure ts1 returns ( ts timestamp )
|
||||
as
|
||||
@ -47,9 +48,9 @@ set term ;^
|
||||
|
||||
commit;"""
|
||||
|
||||
db_1 = db_factory(sql_dialect=3, init=init_script_1)
|
||||
db = db_factory(init=init_script)
|
||||
|
||||
test_script_1 = """SELECT COUNT(*)
|
||||
test_script = """SELECT COUNT(*)
|
||||
FROM ts2
|
||||
WHERE cast(ts_self as varchar(50))=cast(ts_execute as varchar(50))
|
||||
AND cast(ts_self as varchar(50))=cast(ts_select as varchar(50))
|
||||
@ -57,9 +58,9 @@ AND cast(ts_self as varchar(50))=cast(ts_select as varchar(50))
|
||||
|
||||
"""
|
||||
|
||||
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
|
||||
act = isql_act('db', test_script)
|
||||
|
||||
expected_stdout_1 = """
|
||||
expected_stdout = """
|
||||
COUNT
|
||||
=====================
|
||||
2
|
||||
@ -67,8 +68,8 @@ expected_stdout_1 = """
|
||||
"""
|
||||
|
||||
@pytest.mark.version('>=3.0')
|
||||
def test_1(act_1: Action):
|
||||
act_1.expected_stdout = expected_stdout_1
|
||||
act_1.execute()
|
||||
assert act_1.clean_stdout == act_1.clean_expected_stdout
|
||||
def test_1(act: Action):
|
||||
act.expected_stdout = expected_stdout
|
||||
act.execute()
|
||||
assert act.clean_stdout == act.clean_expected_stdout
|
||||
|
||||
|
@ -1,48 +1,34 @@
|
||||
#coding:utf-8
|
||||
#
|
||||
# id: bugs.core_1428
|
||||
# title: Incorrect timestamp substraction in 3 dialect when result is negative number
|
||||
# decription:
|
||||
# 27.07.2021: changed output form using SET LIST ON, added subst. to remove dependency on the number of inner spaces.
|
||||
# Checked on:
|
||||
# 5.0.0.113 SS: 1.025s.
|
||||
# 5.0.0.88 SS: 1.028s.
|
||||
# 4.0.1.2539 SS: 0.942s.
|
||||
# 3.0.8.33476 SS: 2.076s.
|
||||
#
|
||||
# tracker_id: CORE-1428
|
||||
# min_versions: []
|
||||
# versions: 2.1
|
||||
# qmid: bugs.core_1428
|
||||
|
||||
"""
|
||||
ID: issue-1846
|
||||
ISSUE: 1846
|
||||
TITLE: Incorrect timestamp substraction in 3 dialect when result is negative number
|
||||
DESCRIPTION:
|
||||
JIRA: CORE-1428
|
||||
"""
|
||||
|
||||
import pytest
|
||||
from firebird.qa import db_factory, isql_act, Action
|
||||
from firebird.qa import *
|
||||
|
||||
# version: 2.1
|
||||
# resources: None
|
||||
db = db_factory()
|
||||
|
||||
substitutions_1 = [('[ \t]+', ' ')]
|
||||
|
||||
init_script_1 = """"""
|
||||
|
||||
db_1 = db_factory(sql_dialect=3, init=init_script_1)
|
||||
|
||||
test_script_1 = """
|
||||
test_script = """
|
||||
set list on;
|
||||
select (cast('2007-08-22 00:00:00.0019' as timestamp) - cast('2007-08-22 00:00:00.0000' as timestamp)) *86400*10000 as dts_01 from rdb$database;
|
||||
select (cast('2007-08-22 00:00:00.0000' as timestamp) - cast('2007-08-22 00:00:00.0019' as timestamp)) *86400*10000 as dts_02 from rdb$database;
|
||||
"""
|
||||
|
||||
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
|
||||
act = isql_act('db', test_script, substitutions=[('[ \t]+', ' ')])
|
||||
|
||||
expected_stdout_1 = """
|
||||
expected_stdout = """
|
||||
DTS_01 19.008000000
|
||||
DTS_02 -19.008000000
|
||||
DTS_02 -19.008000000
|
||||
"""
|
||||
|
||||
@pytest.mark.version('>=2.1')
|
||||
def test_1(act_1: Action):
|
||||
act_1.expected_stdout = expected_stdout_1
|
||||
act_1.execute()
|
||||
assert act_1.clean_stdout == act_1.clean_expected_stdout
|
||||
@pytest.mark.version('>=3')
|
||||
def test_1(act: Action):
|
||||
act.expected_stdout = expected_stdout
|
||||
act.execute()
|
||||
assert act.clean_stdout == act.clean_expected_stdout
|
||||
|
||||
|
@ -1,40 +1,17 @@
|
||||
#coding:utf-8
|
||||
#
|
||||
# id: bugs.core_1431
|
||||
# title: Greek characters in cp1251 vs uppercasing
|
||||
# decription:
|
||||
# 02-mar-2021. Re-implemented in ordeer to have ability to run this test on Linux.
|
||||
# We run 'init_script' using charset = utf8 but then run separate ISQL-process
|
||||
# with request to establish connection using charset = WIN1251.
|
||||
#
|
||||
# NOTE-1.
|
||||
# Script that must be executed by ISQL does NOT contain any non-ascii characters.
|
||||
# We run query that produces ASCII-ONLY output with *description* of characters
|
||||
# which have no 'partners' when appying upper() function (e.g., ellipsis, euro sign etc).
|
||||
#
|
||||
# NOTE-2.
|
||||
# Character 'SOFT HYPHEN' WAS EXCLUDED from check list: it can not be properly interpreted
|
||||
# on Linux when trying to insert this character:
|
||||
# "UnicodeDecodeError: 'utf8' codec can't decode byte 0xc2 in position ... invalid continuation byte"
|
||||
#
|
||||
# Checked on:
|
||||
# * Windows: 4.0.0.2377, 3.0.8.33420, 2.5.9.27152
|
||||
# * Linux: 4.0.0.2377, 3.0.8.33415
|
||||
#
|
||||
# tracker_id: CORE-1431
|
||||
# min_versions: ['2.1.7']
|
||||
# versions: 2.1.7
|
||||
# qmid:
|
||||
|
||||
"""
|
||||
ID: issue-1849
|
||||
ISSUE: 1849
|
||||
TITLE: Greek characters in cp1251 vs uppercasing
|
||||
DESCRIPTION:
|
||||
JIRA: CORE-1431
|
||||
"""
|
||||
|
||||
import pytest
|
||||
from firebird.qa import db_factory, isql_act, Action
|
||||
from firebird.qa import *
|
||||
|
||||
# version: 2.1.7
|
||||
# resources: None
|
||||
|
||||
substitutions_1 = []
|
||||
|
||||
init_script_1 = """
|
||||
init_script = """
|
||||
recreate table c1251(c char(1) character set win1251, id int, descr varchar(80) );
|
||||
commit;
|
||||
|
||||
@ -172,45 +149,20 @@ init_script_1 = """
|
||||
commit;
|
||||
"""
|
||||
|
||||
db_1 = db_factory(sql_dialect=3, init=init_script_1, charset='UTF8')
|
||||
db = db_factory(init=init_script, charset='UTF8')
|
||||
|
||||
# test_script_1
|
||||
#---
|
||||
#
|
||||
#
|
||||
# db_conn.close()
|
||||
#
|
||||
# sql_cmd='''
|
||||
# set names WIN1251;
|
||||
# connect '%(dsn)s' user '%(user_name)s' password '%(user_password)s';
|
||||
# set list on;
|
||||
# -- Test: following statement should pass OK, w/o exceptions:
|
||||
# select min(t.descr) as has_no_upper_case_equiv
|
||||
# -- PREVIOUSLY we use here: "upper(c) has_no_upper_case_equiv" // can be run on Windows only
|
||||
# from c1251 t
|
||||
# group by upper(t.c)
|
||||
# having count(*) <> 2
|
||||
# ;
|
||||
# ''' % dict(globals(), **locals())
|
||||
#
|
||||
# runProgram( 'isql', [ '-q' ], sql_cmd)
|
||||
#
|
||||
#
|
||||
#---
|
||||
|
||||
test_script_1 = """
|
||||
test_script = """
|
||||
set list on;
|
||||
-- Test: following statement should pass OK, w/o exceptions:
|
||||
select min(t.descr) as has_no_upper_case_equiv
|
||||
-- PREVIOUSLY we use here: "upper(c) has_no_upper_case_equiv" // can be run on Windows only
|
||||
from c1251 t
|
||||
group by upper(t.c)
|
||||
having count(*) <> 2 ;
|
||||
"""
|
||||
|
||||
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
|
||||
act = isql_act('db', test_script)
|
||||
|
||||
expected_stdout_1 = """
|
||||
expected_stdout = """
|
||||
HAS_NO_UPPER_CASE_EQUIV LOW 9 SINGLE QUOTE
|
||||
HAS_NO_UPPER_CASE_EQUIV LOW 9 DOUBLE QUOTE
|
||||
HAS_NO_UPPER_CASE_EQUIV ELLIPSIS
|
||||
@ -244,10 +196,10 @@ expected_stdout_1 = """
|
||||
HAS_NO_UPPER_CASE_EQUIV RIGHT ANGLE QUOTATION MARK
|
||||
"""
|
||||
|
||||
@pytest.mark.version('>=2.1.7')
|
||||
def test_1(act_1: Action):
|
||||
act_1.expected_stdout = expected_stdout_1
|
||||
act_1.execute(charset='WIN1251')
|
||||
assert act_1.clean_stdout == act_1.clean_expected_stdout
|
||||
@pytest.mark.version('>=3')
|
||||
def test_1(act: Action):
|
||||
act.expected_stdout = expected_stdout
|
||||
act.execute(charset='WIN1251')
|
||||
assert act.clean_stdout == act.clean_expected_stdout
|
||||
|
||||
|
||||
|
@ -1,22 +1,17 @@
|
||||
#coding:utf-8
|
||||
#
|
||||
# id: bugs.core_1432
|
||||
# title: Collation not propagated between record formats
|
||||
# decription:
|
||||
# tracker_id: CORE-1432
|
||||
# min_versions: []
|
||||
# versions: 2.5.0
|
||||
# qmid: None
|
||||
|
||||
"""
|
||||
ID: issue-1850
|
||||
ISSUE: 1850
|
||||
TITLE: Collation not propagated between record formats
|
||||
DESCRIPTION:
|
||||
JIRA: CORE-1432
|
||||
"""
|
||||
|
||||
import pytest
|
||||
from firebird.qa import db_factory, isql_act, Action
|
||||
from firebird.qa import *
|
||||
|
||||
# version: 2.5.0
|
||||
# resources: None
|
||||
|
||||
substitutions_1 = []
|
||||
|
||||
init_script_1 = """CREATE DOMAIN D_1250 VARCHAR(10) CHARACTER SET WIN1250 COLLATE WIN1250;
|
||||
init_script = """CREATE DOMAIN D_1250 VARCHAR(10) CHARACTER SET WIN1250 COLLATE WIN1250;
|
||||
CREATE DOMAIN D_CZ VARCHAR(10) CHARACTER SET WIN1250 COLLATE WIN_CZ;
|
||||
|
||||
CREATE TABLE T (I INTEGER, A D_1250);
|
||||
@ -24,9 +19,9 @@ INSERT INTO T VALUES(10, 'a');
|
||||
COMMIT;
|
||||
"""
|
||||
|
||||
db_1 = db_factory(page_size=4096, charset='WIN1250', sql_dialect=3, init=init_script_1)
|
||||
db = db_factory(charset='WIN1250', init=init_script)
|
||||
|
||||
test_script_1 = """SET COUNT ON;
|
||||
test_script = """SET COUNT ON;
|
||||
|
||||
SELECT * FROM T WHERE A='A';
|
||||
|
||||
@ -36,9 +31,9 @@ commit;
|
||||
SELECT * FROM T WHERE A='A';
|
||||
"""
|
||||
|
||||
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
|
||||
act = isql_act('db', test_script)
|
||||
|
||||
expected_stdout_1 = """Records affected: 0
|
||||
expected_stdout = """Records affected: 0
|
||||
|
||||
I A
|
||||
============ ==========
|
||||
@ -48,8 +43,8 @@ Records affected: 1
|
||||
"""
|
||||
|
||||
@pytest.mark.version('>=2.5.0')
|
||||
def test_1(act_1: Action):
|
||||
act_1.expected_stdout = expected_stdout_1
|
||||
act_1.execute()
|
||||
assert act_1.clean_stdout == act_1.clean_expected_stdout
|
||||
def test_1(act: Action):
|
||||
act.expected_stdout = expected_stdout
|
||||
act.execute()
|
||||
assert act.clean_stdout == act.clean_expected_stdout
|
||||
|
||||
|
@ -1,27 +1,20 @@
|
||||
#coding:utf-8
|
||||
#
|
||||
# id: bugs.core_1434
|
||||
# title: Incorrect result with EXECUTE STATEMENT and VARCHAR columns
|
||||
# decription: Last two bytes of VARCHAR columns are lost.
|
||||
# tracker_id: CORE-1434
|
||||
# min_versions: []
|
||||
# versions: 2.0.2
|
||||
# qmid: bugs.core_1434
|
||||
|
||||
"""
|
||||
ID: issue-1852
|
||||
ISSUE: 1852
|
||||
TITLE: Incorrect result with EXECUTE STATEMENT and VARCHAR columns
|
||||
DESCRIPTION: Last two bytes of VARCHAR columns are lost.
|
||||
JIRA: CORE-1434
|
||||
"""
|
||||
|
||||
import pytest
|
||||
from firebird.qa import db_factory, isql_act, Action
|
||||
from firebird.qa import *
|
||||
|
||||
# version: 2.0.2
|
||||
# resources: None
|
||||
db = db_factory()
|
||||
|
||||
substitutions_1 = []
|
||||
|
||||
init_script_1 = """"""
|
||||
|
||||
db_1 = db_factory(sql_dialect=3, init=init_script_1)
|
||||
|
||||
test_script_1 = """
|
||||
set list on;
|
||||
test_script = """
|
||||
set list on;
|
||||
set term ^;
|
||||
execute block returns (res varchar(31))
|
||||
as
|
||||
@ -38,44 +31,44 @@ test_script_1 = """
|
||||
set term ;^
|
||||
"""
|
||||
|
||||
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
|
||||
act = isql_act('db', test_script)
|
||||
|
||||
expected_stdout_1 = """
|
||||
RES RDB$PAGES
|
||||
RES RDB$DATABASE
|
||||
RES RDB$FIELDS
|
||||
RES RDB$INDEX_SEGMENTS
|
||||
RES RDB$INDICES
|
||||
RES RDB$RELATION_FIELDS
|
||||
RES RDB$RELATIONS
|
||||
RES RDB$VIEW_RELATIONS
|
||||
RES RDB$FORMATS
|
||||
RES RDB$SECURITY_CLASSES
|
||||
RES RDB$FILES
|
||||
RES RDB$TYPES
|
||||
RES RDB$TRIGGERS
|
||||
RES RDB$DEPENDENCIES
|
||||
RES RDB$FUNCTIONS
|
||||
RES RDB$FUNCTION_ARGUMENTS
|
||||
RES RDB$FILTERS
|
||||
RES RDB$TRIGGER_MESSAGES
|
||||
RES RDB$USER_PRIVILEGES
|
||||
RES RDB$TRANSACTIONS
|
||||
RES RDB$GENERATORS
|
||||
RES RDB$FIELD_DIMENSIONS
|
||||
expected_stdout = """
|
||||
RES RDB$PAGES
|
||||
RES RDB$DATABASE
|
||||
RES RDB$FIELDS
|
||||
RES RDB$INDEX_SEGMENTS
|
||||
RES RDB$INDICES
|
||||
RES RDB$RELATION_FIELDS
|
||||
RES RDB$RELATIONS
|
||||
RES RDB$VIEW_RELATIONS
|
||||
RES RDB$FORMATS
|
||||
RES RDB$SECURITY_CLASSES
|
||||
RES RDB$FILES
|
||||
RES RDB$TYPES
|
||||
RES RDB$TRIGGERS
|
||||
RES RDB$DEPENDENCIES
|
||||
RES RDB$FUNCTIONS
|
||||
RES RDB$FUNCTION_ARGUMENTS
|
||||
RES RDB$FILTERS
|
||||
RES RDB$TRIGGER_MESSAGES
|
||||
RES RDB$USER_PRIVILEGES
|
||||
RES RDB$TRANSACTIONS
|
||||
RES RDB$GENERATORS
|
||||
RES RDB$FIELD_DIMENSIONS
|
||||
RES RDB$RELATION_CONSTRAINTS
|
||||
RES RDB$REF_CONSTRAINTS
|
||||
RES RDB$CHECK_CONSTRAINTS
|
||||
RES RDB$LOG_FILES
|
||||
RES RDB$PROCEDURES
|
||||
RES RDB$REF_CONSTRAINTS
|
||||
RES RDB$CHECK_CONSTRAINTS
|
||||
RES RDB$LOG_FILES
|
||||
RES RDB$PROCEDURES
|
||||
RES RDB$PROCEDURE_PARAMETERS
|
||||
RES RDB$CHARACTER_SETS
|
||||
RES RDB$COLLATIONS
|
||||
RES RDB$CHARACTER_SETS
|
||||
RES RDB$COLLATIONS
|
||||
"""
|
||||
|
||||
@pytest.mark.version('>=2.0.2')
|
||||
def test_1(act_1: Action):
|
||||
act_1.expected_stdout = expected_stdout_1
|
||||
act_1.execute()
|
||||
assert act_1.clean_stdout == act_1.clean_expected_stdout
|
||||
@pytest.mark.version('>=3')
|
||||
def test_1(act: Action):
|
||||
act.expected_stdout = expected_stdout
|
||||
act.execute()
|
||||
assert act.clean_stdout == act.clean_expected_stdout
|
||||
|
||||
|
@ -1,26 +1,19 @@
|
||||
#coding:utf-8
|
||||
#
|
||||
# id: bugs.core_1436
|
||||
# title: Outer joins don't work properly with the MON$ tables
|
||||
# decription:
|
||||
# tracker_id: CORE-1436
|
||||
# min_versions: []
|
||||
# versions: 2.1
|
||||
# qmid: bugs.core_1436
|
||||
|
||||
"""
|
||||
ID: issue-1854
|
||||
ISSUE: 1854
|
||||
TITLE: Outer joins don't work properly with the MON$ tables
|
||||
DESCRIPTION:
|
||||
JIRA: CORE-1436
|
||||
"""
|
||||
|
||||
import pytest
|
||||
from firebird.qa import db_factory, isql_act, Action
|
||||
from firebird.qa import *
|
||||
|
||||
# version: 2.1
|
||||
# resources: None
|
||||
db = db_factory()
|
||||
|
||||
substitutions_1 = []
|
||||
|
||||
init_script_1 = """"""
|
||||
|
||||
db_1 = db_factory(sql_dialect=3, init=init_script_1)
|
||||
|
||||
test_script_1 = """
|
||||
test_script = """
|
||||
set list on;
|
||||
select db.MON$FORCED_WRITES fw
|
||||
from mon$attachments att
|
||||
@ -31,15 +24,15 @@ test_script_1 = """
|
||||
-- left join mon$database db on db.mon$creation_date = att.mon$timestamp;
|
||||
"""
|
||||
|
||||
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
|
||||
act = isql_act('db', test_script)
|
||||
|
||||
expected_stdout_1 = """
|
||||
expected_stdout = """
|
||||
FW <null>
|
||||
"""
|
||||
|
||||
@pytest.mark.version('>=2.1')
|
||||
def test_1(act_1: Action):
|
||||
act_1.expected_stdout = expected_stdout_1
|
||||
act_1.execute()
|
||||
assert act_1.clean_stdout == act_1.clean_expected_stdout
|
||||
@pytest.mark.version('>=3')
|
||||
def test_1(act: Action):
|
||||
act.expected_stdout = expected_stdout
|
||||
act.execute()
|
||||
assert act.clean_stdout == act.clean_expected_stdout
|
||||
|
||||
|
@ -1,22 +1,17 @@
|
||||
#coding:utf-8
|
||||
#
|
||||
# id: bugs.core_1444
|
||||
# title: Execute statement 'select ....' into new....
|
||||
# decription:
|
||||
# tracker_id: CORE-1444
|
||||
# min_versions: []
|
||||
# versions: 2.0.2
|
||||
# qmid: bugs.core_1444
|
||||
|
||||
"""
|
||||
ID: issue-1862
|
||||
ISSUE: 1862
|
||||
TITLE: Execute statement 'select ....' into new....
|
||||
DESCRIPTION:
|
||||
JIRA: CORE-1444
|
||||
"""
|
||||
|
||||
import pytest
|
||||
from firebird.qa import db_factory, isql_act, Action
|
||||
from firebird.qa import *
|
||||
|
||||
# version: 2.0.2
|
||||
# resources: None
|
||||
|
||||
substitutions_1 = []
|
||||
|
||||
init_script_1 = """CREATE EXCEPTION DEXC '???';
|
||||
init_script = """CREATE EXCEPTION DEXC '???';
|
||||
|
||||
CREATE TABLE TEST
|
||||
(
|
||||
@ -60,9 +55,9 @@ set term ; ^
|
||||
commit;
|
||||
"""
|
||||
|
||||
db_1 = db_factory(sql_dialect=3, init=init_script_1)
|
||||
db = db_factory(init=init_script)
|
||||
|
||||
test_script_1 = """/* Bug */
|
||||
test_script = """/* Bug */
|
||||
insert into test(C1,C2) values (NULL,NULL);
|
||||
|
||||
/* OK */
|
||||
@ -73,9 +68,9 @@ commit;
|
||||
select * from test;
|
||||
"""
|
||||
|
||||
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
|
||||
act = isql_act('db', test_script)
|
||||
|
||||
expected_stdout_1 = """
|
||||
expected_stdout = """
|
||||
C1 C2
|
||||
=============================== ===============================
|
||||
NONE NONE
|
||||
@ -83,9 +78,9 @@ NONE NONE
|
||||
|
||||
"""
|
||||
|
||||
@pytest.mark.version('>=2.0.2')
|
||||
def test_1(act_1: Action):
|
||||
act_1.expected_stdout = expected_stdout_1
|
||||
act_1.execute()
|
||||
assert act_1.clean_stdout == act_1.clean_expected_stdout
|
||||
@pytest.mark.version('>=3')
|
||||
def test_1(act: Action):
|
||||
act.expected_stdout = expected_stdout
|
||||
act.execute()
|
||||
assert act.clean_stdout == act.clean_expected_stdout
|
||||
|
||||
|
@ -1,22 +1,17 @@
|
||||
#coding:utf-8
|
||||
#
|
||||
# id: bugs.core_1451
|
||||
# title: Using RDB$DB_KEY in where section while selecting from a procedure crashes the server
|
||||
# decription:
|
||||
# tracker_id: CORE-1451
|
||||
# min_versions: []
|
||||
# versions: 2.5.0
|
||||
# qmid: bugs.core_1451-250
|
||||
|
||||
"""
|
||||
ID: issue-1869
|
||||
ISSUE: 1869
|
||||
TITLE: Using RDB$DB_KEY in where section while selecting from a procedure crashes the server
|
||||
DESCRIPTION:
|
||||
JIRA: CORE-1451
|
||||
"""
|
||||
|
||||
import pytest
|
||||
from firebird.qa import db_factory, isql_act, Action
|
||||
from firebird.qa import *
|
||||
|
||||
# version: 2.5.0
|
||||
# resources: None
|
||||
|
||||
substitutions_1 = [('line\\s[0-9]+,', 'line x'), ('column\\s[0-9]+', 'column y')]
|
||||
|
||||
init_script_1 = """SET TERM ^;
|
||||
init_script = """SET TERM ^;
|
||||
create procedure test_proc
|
||||
returns (A INTEGER)
|
||||
as
|
||||
@ -28,15 +23,17 @@ SET TERM ;^
|
||||
COMMIT;
|
||||
"""
|
||||
|
||||
db_1 = db_factory(sql_dialect=3, init=init_script_1)
|
||||
db = db_factory(init=init_script)
|
||||
|
||||
test_script_1 = """select * from test_proc
|
||||
test_script = """select * from test_proc
|
||||
where rdb$db_key is not null;
|
||||
"""
|
||||
|
||||
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
|
||||
act = isql_act('db', test_script,
|
||||
substitutions=[('line\\s[0-9]+,', 'line x'),
|
||||
('column\\s[0-9]+', 'column y')])
|
||||
|
||||
expected_stderr_1 = """Statement failed, SQLSTATE = 42S22
|
||||
expected_stderr = """Statement failed, SQLSTATE = 42S22
|
||||
Dynamic SQL Error
|
||||
-SQL error code = -206
|
||||
-Column unknown
|
||||
@ -44,9 +41,9 @@ Dynamic SQL Error
|
||||
-At line 2, column 7
|
||||
"""
|
||||
|
||||
@pytest.mark.version('>=2.5.0')
|
||||
def test_1(act_1: Action):
|
||||
act_1.expected_stderr = expected_stderr_1
|
||||
act_1.execute()
|
||||
assert act_1.clean_stderr == act_1.clean_expected_stderr
|
||||
@pytest.mark.version('>=3')
|
||||
def test_1(act: Action):
|
||||
act.expected_stderr = expected_stderr
|
||||
act.execute()
|
||||
assert act.clean_stderr == act.clean_expected_stderr
|
||||
|
||||
|
@ -1,22 +1,17 @@
|
||||
#coding:utf-8
|
||||
#
|
||||
# id: bugs.core_1453
|
||||
# title: Allow usage of functions in LIST delimiter parameter
|
||||
# decription:
|
||||
# tracker_id: CORE-1443
|
||||
# min_versions: ['2.5.0']
|
||||
# versions: 2.5.0
|
||||
# qmid: None
|
||||
|
||||
"""
|
||||
ID: issue-1871
|
||||
ISSUE: 1871
|
||||
TITLE: Allow usage of functions in LIST delimiter parameter
|
||||
DESCRIPTION:
|
||||
JIRA: CORE-1443
|
||||
"""
|
||||
|
||||
import pytest
|
||||
from firebird.qa import db_factory, isql_act, Action
|
||||
from firebird.qa import *
|
||||
|
||||
# version: 2.5.0
|
||||
# resources: None
|
||||
|
||||
substitutions_1 = []
|
||||
|
||||
init_script_1 = """CREATE TABLE T1 (ID INTEGER, NAME CHAR(20));
|
||||
init_script = """CREATE TABLE T1 (ID INTEGER, NAME CHAR(20));
|
||||
COMMIT;
|
||||
INSERT INTO T1 (ID,NAME) VALUES (1,'ORANGE');
|
||||
INSERT INTO T1 (ID,NAME) VALUES (1,'APPLE');
|
||||
@ -27,17 +22,16 @@ INSERT INTO T1 (ID,NAME) VALUES (2,'PEAR');
|
||||
COMMIT;
|
||||
"""
|
||||
|
||||
db_1 = db_factory(page_size=4096, sql_dialect=3, init=init_script_1)
|
||||
db = db_factory(init=init_script)
|
||||
|
||||
test_script_1 = """select ID, LIST( trim(NAME), ASCII_CHAR(35) )
|
||||
test_script = """select ID, LIST( trim(NAME), ASCII_CHAR(35) )
|
||||
from T1
|
||||
group by 1;
|
||||
"""
|
||||
|
||||
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
|
||||
act = isql_act('db', test_script)
|
||||
|
||||
expected_stdout_1 = """Database: localhost:C:\\Users\\win7\\Firebird_tests\\fbt-repository\\tmp\\bugs.core_1453.fdb, User: SYSDBA
|
||||
SQL> CON> CON>
|
||||
expected_stdout = """
|
||||
ID LIST
|
||||
============ =================
|
||||
1 0:1
|
||||
@ -51,11 +45,11 @@ LIST:
|
||||
PEAR#ORANGE#APPLE
|
||||
==============================================================================
|
||||
|
||||
SQL>"""
|
||||
"""
|
||||
|
||||
@pytest.mark.version('>=2.5.0')
|
||||
def test_1(act_1: Action):
|
||||
act_1.expected_stdout = expected_stdout_1
|
||||
act_1.execute()
|
||||
assert act_1.clean_stdout == act_1.clean_expected_stdout
|
||||
def test_1(act: Action):
|
||||
act.expected_stdout = expected_stdout
|
||||
act.execute()
|
||||
assert act.clean_stdout == act.clean_expected_stdout
|
||||
|
||||
|
@ -1,24 +1,19 @@
|
||||
#coding:utf-8
|
||||
#
|
||||
# id: bugs.core_1454
|
||||
# title: ALTER mechanism for computed fields
|
||||
# decription: Computed field had a lot of inconsistencies and problems
|
||||
# It's possible to use a explicit type, but only together with a (new) computed expression.
|
||||
# cf core-0847
|
||||
# tracker_id: CORE-1454
|
||||
# min_versions: ['2.5']
|
||||
# versions: 2.5.0
|
||||
# qmid: None
|
||||
|
||||
"""
|
||||
ID: issue-1872
|
||||
ISSUE: 1872
|
||||
TITLE: ALTER mechanism for computed fields
|
||||
DESCRIPTION:
|
||||
Computed field had a lot of inconsistencies and problems
|
||||
It's possible to use a explicit type, but only together with a (new) computed expression.
|
||||
JIRA: CORE-1454
|
||||
"""
|
||||
|
||||
import pytest
|
||||
from firebird.qa import db_factory, isql_act, Action
|
||||
from firebird.qa import *
|
||||
|
||||
# version: 2.5.0
|
||||
# resources: None
|
||||
|
||||
substitutions_1 = []
|
||||
|
||||
init_script_1 = """
|
||||
init_script = """
|
||||
recreate table t (
|
||||
f1 varchar(10),
|
||||
f2 varchar(10),
|
||||
@ -29,9 +24,9 @@ init_script_1 = """
|
||||
commit;
|
||||
"""
|
||||
|
||||
db_1 = db_factory(page_size=4096, sql_dialect=3, init=init_script_1, charset='win1252')
|
||||
db = db_factory(init=init_script, charset='win1252')
|
||||
|
||||
test_script_1 = """
|
||||
test_script = """
|
||||
set list on;
|
||||
set width fld_name 31;
|
||||
set width fld_expr 80;
|
||||
@ -56,9 +51,9 @@ test_script_1 = """
|
||||
where b.rdb$field_name = upper('cf');
|
||||
"""
|
||||
|
||||
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
|
||||
act = isql_act('db', test_script)
|
||||
|
||||
expected_stdout_1 = """
|
||||
expected_stdout = """
|
||||
F1 0123456789
|
||||
F2 abcdefghij
|
||||
CF 0123456789 - abcdefghij
|
||||
@ -73,8 +68,8 @@ expected_stdout_1 = """
|
||||
FLD_LENGTH 30
|
||||
"""
|
||||
|
||||
@pytest.mark.version('>=2.5.0')
|
||||
def test_1(act_1: Action):
|
||||
act_1.expected_stdout = expected_stdout_1
|
||||
act_1.execute()
|
||||
assert act_1.clean_stdout == act_1.clean_expected_stdout
|
||||
@pytest.mark.version('>=3')
|
||||
def test_1(act: Action):
|
||||
act.expected_stdout = expected_stdout
|
||||
act.execute()
|
||||
assert act.clean_stdout == act.clean_expected_stdout
|
||||
|
@ -1,29 +1,24 @@
|
||||
#coding:utf-8
|
||||
#
|
||||
# id: bugs.core_1462
|
||||
# title: Server crash caused by a buffer overrun in the optimizer when more than 255 relation references exist in the query
|
||||
# decription:
|
||||
# tracker_id: CORE-1462
|
||||
# min_versions: []
|
||||
# versions: 3.0
|
||||
# qmid: bugs.core_1462-21
|
||||
|
||||
"""
|
||||
ID: issue-773
|
||||
ISSUE: 773
|
||||
TITLE: Server crash caused by a buffer overrun in the optimizer when more than 255 relation references exist in the query
|
||||
DESCRIPTION:
|
||||
JIRA: CORE-1462
|
||||
"""
|
||||
|
||||
import pytest
|
||||
from firebird.qa import db_factory, isql_act, Action
|
||||
from firebird.qa import *
|
||||
|
||||
# version: 3.0
|
||||
# resources: None
|
||||
|
||||
substitutions_1 = []
|
||||
|
||||
init_script_1 = """create table test (i integer);
|
||||
init_script = """create table test (i integer);
|
||||
create index test_i on test(i);
|
||||
commit;
|
||||
"""
|
||||
|
||||
db_1 = db_factory(sql_dialect=3, init=init_script_1)
|
||||
db = db_factory(init=init_script)
|
||||
|
||||
test_script_1 = """select test.i from test
|
||||
test_script = """select test.i from test
|
||||
inner join test as t1 on t1.i = test.i
|
||||
inner join test as t2 on t2.i = test.i
|
||||
inner join test as t3 on t3.i = test.i
|
||||
@ -283,16 +278,16 @@ test_script_1 = """select test.i from test
|
||||
;
|
||||
"""
|
||||
|
||||
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
|
||||
act = isql_act('db', test_script)
|
||||
|
||||
expected_stderr_1 = """Statement failed, SQLSTATE = 54001
|
||||
expected_stderr = """Statement failed, SQLSTATE = 54001
|
||||
Dynamic SQL Error
|
||||
-Too many Contexts of Relation/Procedure/Views. Maximum allowed is 256
|
||||
"""
|
||||
|
||||
@pytest.mark.version('>=3.0')
|
||||
def test_1(act_1: Action):
|
||||
act_1.expected_stderr = expected_stderr_1
|
||||
act_1.execute()
|
||||
assert act_1.clean_stderr == act_1.clean_expected_stderr
|
||||
def test_1(act: Action):
|
||||
act.expected_stderr = expected_stderr
|
||||
act.execute()
|
||||
assert act.clean_stderr == act.clean_expected_stderr
|
||||
|
||||
|
@ -1,30 +1,23 @@
|
||||
#coding:utf-8
|
||||
#
|
||||
# id: bugs.core_1482
|
||||
# title: Make optimizer to consider ORDER BY optimization when making decision about join order
|
||||
# decription:
|
||||
# tracker_id: CORE-1482
|
||||
# min_versions: ['3.0']
|
||||
# versions: 3.0
|
||||
# qmid: None
|
||||
|
||||
"""
|
||||
ID: issue-1898
|
||||
ISSUE: 1898
|
||||
TITLE: Make optimizer to consider ORDER BY optimization when making decision about join order
|
||||
DESCRIPTION:
|
||||
JIRA: CORE-1482
|
||||
"""
|
||||
|
||||
import pytest
|
||||
from firebird.qa import db_factory, isql_act, Action
|
||||
from firebird.qa import *
|
||||
|
||||
# version: 3.0
|
||||
# resources: None
|
||||
db = db_factory()
|
||||
|
||||
substitutions_1 = []
|
||||
|
||||
init_script_1 = """"""
|
||||
|
||||
db_1 = db_factory(page_size=4096, sql_dialect=3, init=init_script_1)
|
||||
|
||||
test_script_1 = """
|
||||
test_script = """
|
||||
recreate table tcolor(id int , name varchar(20) );
|
||||
recreate table thorses(id int, color_id int, name varchar(20));
|
||||
commit;
|
||||
|
||||
|
||||
set term ^;
|
||||
execute block as
|
||||
declare i int;
|
||||
@ -49,13 +42,13 @@ test_script_1 = """
|
||||
^
|
||||
set term ;^
|
||||
commit;
|
||||
|
||||
|
||||
create index tcolor_id on tcolor(id);
|
||||
create index thorses_color_id on thorses(color_id);
|
||||
-- this index was forgotten in previous revisions:
|
||||
create index thorses_id on thorses(id);
|
||||
commit;
|
||||
|
||||
|
||||
set list on;
|
||||
select (select count(*) from tcolor) colors_cnt, (select count(*) from thorses) horses_cnt
|
||||
from rdb$database;
|
||||
@ -65,9 +58,9 @@ test_script_1 = """
|
||||
select * from tcolor m join thorses d on m.id = d.color_id order by d.id rows 1;
|
||||
"""
|
||||
|
||||
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
|
||||
act = isql_act('db', test_script)
|
||||
|
||||
expected_stdout_1 = """
|
||||
expected_stdout = """
|
||||
COLORS_CNT 50
|
||||
HORSES_CNT 50000
|
||||
|
||||
@ -75,8 +68,8 @@ expected_stdout_1 = """
|
||||
"""
|
||||
|
||||
@pytest.mark.version('>=3.0')
|
||||
def test_1(act_1: Action):
|
||||
act_1.expected_stdout = expected_stdout_1
|
||||
act_1.execute()
|
||||
assert act_1.clean_stdout == act_1.clean_expected_stdout
|
||||
def test_1(act: Action):
|
||||
act.expected_stdout = expected_stdout
|
||||
act.execute()
|
||||
assert act.clean_stdout == act.clean_expected_stdout
|
||||
|
||||
|
@ -1,40 +1,33 @@
|
||||
#coding:utf-8
|
||||
#
|
||||
# id: bugs.core_1489
|
||||
# title: DATEADD wrong work with NULL arguments
|
||||
# decription:
|
||||
# tracker_id: CORE-1489
|
||||
# min_versions: []
|
||||
# versions: 2.1.0
|
||||
# qmid: bugs.core_1489
|
||||
|
||||
import pytest
|
||||
from firebird.qa import db_factory, isql_act, Action
|
||||
|
||||
# version: 2.1.0
|
||||
# resources: None
|
||||
|
||||
substitutions_1 = []
|
||||
|
||||
init_script_1 = """"""
|
||||
|
||||
db_1 = db_factory(sql_dialect=3, init=init_script_1)
|
||||
|
||||
test_script_1 = """SELECT 1, DATEADD(SECOND, Null, CAST('01.01.2007' AS DATE)) FROM RDB$DATABASE;
|
||||
"""
|
||||
ID: issue-1904
|
||||
ISSUE: 1904
|
||||
TITLE: DATEADD wrong work with NULL arguments
|
||||
DESCRIPTION:
|
||||
JIRA: CORE-1489
|
||||
"""
|
||||
|
||||
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
|
||||
import pytest
|
||||
from firebird.qa import *
|
||||
|
||||
expected_stdout_1 = """
|
||||
db = db_factory()
|
||||
|
||||
test_script = """SELECT 1, DATEADD(SECOND, Null, CAST('01.01.2007' AS DATE)) FROM RDB$DATABASE;
|
||||
"""
|
||||
|
||||
act = isql_act('db', test_script)
|
||||
|
||||
expected_stdout = """
|
||||
CONSTANT DATEADD
|
||||
============ ===========
|
||||
1 <null>
|
||||
|
||||
"""
|
||||
|
||||
@pytest.mark.version('>=2.1.0')
|
||||
def test_1(act_1: Action):
|
||||
act_1.expected_stdout = expected_stdout_1
|
||||
act_1.execute()
|
||||
assert act_1.clean_stdout == act_1.clean_expected_stdout
|
||||
@pytest.mark.version('>=3')
|
||||
def test_1(act: Action):
|
||||
act.expected_stdout = expected_stdout
|
||||
act.execute()
|
||||
assert act.clean_stdout == act.clean_expected_stdout
|
||||
|
||||
|
@ -1,26 +1,19 @@
|
||||
#coding:utf-8
|
||||
#
|
||||
# id: bugs.core_1492
|
||||
# title: BLOB isn't compatible with [VAR]CHAR in COALESCE
|
||||
# decription:
|
||||
# tracker_id: CORE-1492
|
||||
# min_versions: []
|
||||
# versions: 2.1
|
||||
# qmid: bugs.core_1492
|
||||
|
||||
"""
|
||||
ID: issue-1907
|
||||
ISSUE: 1907
|
||||
TITLE: BLOB isn't compatible with [VAR]CHAR in COALESCE
|
||||
DESCRIPTION:
|
||||
JIRA: CORE-1492
|
||||
"""
|
||||
|
||||
import pytest
|
||||
from firebird.qa import db_factory, isql_act, Action
|
||||
from firebird.qa import *
|
||||
|
||||
# version: 2.1
|
||||
# resources: None
|
||||
db = db_factory()
|
||||
|
||||
substitutions_1 = [('B_BLOB.*', 'B_BLOB')]
|
||||
|
||||
init_script_1 = """"""
|
||||
|
||||
db_1 = db_factory(sql_dialect=3, init=init_script_1)
|
||||
|
||||
test_script_1 = """
|
||||
test_script = """
|
||||
recreate table t (id int primary key, b blob sub_type text );
|
||||
commit;
|
||||
|
||||
@ -34,17 +27,17 @@ test_script_1 = """
|
||||
order by id;
|
||||
"""
|
||||
|
||||
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
|
||||
act = isql_act('db', test_script, substitutions=[('B_BLOB.*', 'B_BLOB')])
|
||||
|
||||
expected_stdout_1 = """
|
||||
expected_stdout = """
|
||||
B_BLOB 0:1
|
||||
B_BLOB 82:1e0
|
||||
QWER
|
||||
"""
|
||||
|
||||
@pytest.mark.version('>=2.1')
|
||||
def test_1(act_1: Action):
|
||||
act_1.expected_stdout = expected_stdout_1
|
||||
act_1.execute()
|
||||
assert act_1.clean_stdout == act_1.clean_expected_stdout
|
||||
@pytest.mark.version('>=3')
|
||||
def test_1(act: Action):
|
||||
act.expected_stdout = expected_stdout
|
||||
act.execute()
|
||||
assert act.clean_stdout == act.clean_expected_stdout
|
||||
|
||||
|
@ -1,43 +1,35 @@
|
||||
#coding:utf-8
|
||||
#
|
||||
# id: bugs.core_1497
|
||||
# title: New builtin function DATEADD() implements wrong choice of keywords for expanded syntax
|
||||
# decription:
|
||||
# tracker_id: CORE-1497
|
||||
# min_versions: ['2.1.0']
|
||||
# versions: 2.1.0
|
||||
# qmid: None
|
||||
|
||||
"""
|
||||
ID: issue-1912
|
||||
ISSUE: 1912
|
||||
TITLE: New builtin function DATEADD() implements wrong choice of keywords for expanded syntax
|
||||
DESCRIPTION:
|
||||
JIRA: CORE-1497
|
||||
"""
|
||||
|
||||
import pytest
|
||||
from firebird.qa import db_factory, isql_act, Action
|
||||
from firebird.qa import *
|
||||
|
||||
# version: 2.1.0
|
||||
# resources: None
|
||||
db = db_factory()
|
||||
|
||||
substitutions_1 = []
|
||||
|
||||
init_script_1 = """"""
|
||||
|
||||
db_1 = db_factory(page_size=4096, sql_dialect=3, init=init_script_1)
|
||||
|
||||
test_script_1 = """SELECT DATEADD(1 DAY TO date '29-Feb-2012')
|
||||
test_script = """SELECT DATEADD(1 DAY TO date '29-Feb-2012')
|
||||
,DATEADD(1 MONTH TO date '29-Feb-2012')
|
||||
,DATEADD(1 YEAR TO date '29-Feb-2012')
|
||||
FROM RDB$DATABASE;"""
|
||||
|
||||
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
|
||||
act = isql_act('db', test_script)
|
||||
|
||||
expected_stdout_1 = """Database: localhost:C:\\fbtest2\\tmp\\bugs.core_1497.fdb, User: SYSDBA
|
||||
SQL> CON> CON> CON>
|
||||
expected_stdout = """
|
||||
DATEADD DATEADD DATEADD
|
||||
=========== =========== ===========
|
||||
2012-03-01 2012-03-29 2013-02-28
|
||||
|
||||
SQL>"""
|
||||
"""
|
||||
|
||||
@pytest.mark.version('>=2.1.0')
|
||||
def test_1(act_1: Action):
|
||||
act_1.expected_stdout = expected_stdout_1
|
||||
act_1.execute()
|
||||
assert act_1.clean_stdout == act_1.clean_expected_stdout
|
||||
@pytest.mark.version('>=3')
|
||||
def test_1(act: Action):
|
||||
act.expected_stdout = expected_stdout
|
||||
act.execute()
|
||||
assert act.clean_stdout == act.clean_expected_stdout
|
||||
|
||||
|
@ -1,68 +1,24 @@
|
||||
#coding:utf-8
|
||||
#
|
||||
# id: bugs.core_1506
|
||||
# title: Server crash with isc_dsql_execute_immediate and zero length string
|
||||
# decription:
|
||||
# Confirmed on 2.1.0.17798, got:
|
||||
# Error while executing SQL statement:
|
||||
#
|
||||
# - SQLCODE: -902
|
||||
#
|
||||
# - Unable to complete network request to host "localhost".
|
||||
#
|
||||
# - Error reading data from the connection.
|
||||
# -902, 335544721)
|
||||
# firebird.log contains only this:
|
||||
# CSPROG Sat Mar 10 19:13:29 2018
|
||||
# INET/inet_error: read errno = 10054
|
||||
#
|
||||
# Checked on:
|
||||
# 2.5.9.27107: OK, 0.297s.
|
||||
# 3.0.4.32924: OK, 1.562s.
|
||||
# 4.0.0.918: OK, 1.735s.
|
||||
#
|
||||
# NB: FB 3.+ contain TWO messages with almost the same text about SQLSTATE = -104.
|
||||
# Second line is filtered out - see 'substitutions' section.
|
||||
#
|
||||
# tracker_id: CORE-1506
|
||||
# min_versions: ['2.5.0']
|
||||
# versions: 2.5
|
||||
# qmid: None
|
||||
|
||||
import pytest
|
||||
from firebird.qa import db_factory, python_act, Action
|
||||
from firebird.driver import DatabaseError
|
||||
|
||||
# version: 2.5
|
||||
# resources: None
|
||||
|
||||
substitutions_1 = [('- SQL error code.*', '')]
|
||||
|
||||
init_script_1 = """"""
|
||||
|
||||
db_1 = db_factory(sql_dialect=3, init=init_script_1)
|
||||
|
||||
# test_script_1
|
||||
#---
|
||||
#
|
||||
# try:
|
||||
# db_conn.execute_immediate('')
|
||||
# except Exception, e:
|
||||
# print( e[0] )
|
||||
#
|
||||
#---
|
||||
|
||||
act_1 = python_act('db_1', substitutions=substitutions_1)
|
||||
|
||||
expected_stdout_1 = """
|
||||
Error while executing SQL statement:
|
||||
- SQLCODE: -104
|
||||
- Unexpected end of command
|
||||
"""
|
||||
ID: issue-1921
|
||||
ISSUE: 1921
|
||||
TITLE: Server crash with isc_dsql_execute_immediate and zero length string
|
||||
DESCRIPTION:
|
||||
JIRA: CORE-1506
|
||||
"""
|
||||
|
||||
@pytest.mark.version('>=2.5')
|
||||
def test_1(act_1: Action):
|
||||
with act_1.db.connect() as con:
|
||||
import pytest
|
||||
from firebird.qa import *
|
||||
from firebird.driver import DatabaseError
|
||||
|
||||
db = db_factory()
|
||||
|
||||
act = python_act('db', substitutions=[('- SQL error code.*', '')])
|
||||
|
||||
@pytest.mark.version('>=3')
|
||||
def test_1(act: Action):
|
||||
with act.db.connect() as con:
|
||||
with pytest.raises(DatabaseError, match='.*-Unexpected end of command.*'):
|
||||
con.execute_immediate('')
|
||||
|
||||
|
@ -1,29 +1,19 @@
|
||||
#coding:utf-8
|
||||
#
|
||||
# id: bugs.core_1509
|
||||
# title: Conversion from double to varchar insert trailing spaces
|
||||
# decription:
|
||||
# Confirmed bug on WI-V2.0.0.12724: output of cast(cast(0e0 as double precision) as varchar(32))||'z'
|
||||
# is: |0.0000000000000000 z| (four spaces inside)
|
||||
#
|
||||
# tracker_id: CORE-1509
|
||||
# min_versions: []
|
||||
# versions: 2.5.0
|
||||
# qmid:
|
||||
|
||||
"""
|
||||
ID: issue-1924
|
||||
ISSUE: 1924
|
||||
TITLE: Conversion from double to varchar insert trailing spaces
|
||||
DESCRIPTION:
|
||||
JIRA: CORE-1509
|
||||
"""
|
||||
|
||||
import pytest
|
||||
from firebird.qa import db_factory, isql_act, Action
|
||||
from firebird.qa import *
|
||||
|
||||
# version: 2.5.0
|
||||
# resources: None
|
||||
db = db_factory()
|
||||
|
||||
substitutions_1 = []
|
||||
|
||||
init_script_1 = """"""
|
||||
|
||||
db_1 = db_factory(sql_dialect=3, init=init_script_1)
|
||||
|
||||
test_script_1 = """
|
||||
test_script = """
|
||||
set list on;
|
||||
select
|
||||
iif( position(' z' in t1)>0, 'BAD: >' || t1 || '<', 'OK.') as chk1
|
||||
@ -38,17 +28,17 @@ test_script_1 = """
|
||||
);
|
||||
"""
|
||||
|
||||
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
|
||||
act = isql_act('db', test_script)
|
||||
|
||||
expected_stdout_1 = """
|
||||
expected_stdout = """
|
||||
CHK1 OK.
|
||||
CHK2 OK.
|
||||
CHK3 OK.
|
||||
"""
|
||||
|
||||
@pytest.mark.version('>=2.5.0')
|
||||
def test_1(act_1: Action):
|
||||
act_1.expected_stdout = expected_stdout_1
|
||||
act_1.execute()
|
||||
assert act_1.clean_stdout == act_1.clean_expected_stdout
|
||||
@pytest.mark.version('>=3')
|
||||
def test_1(act: Action):
|
||||
act.expected_stdout = expected_stdout
|
||||
act.execute()
|
||||
assert act.clean_stdout == act.clean_expected_stdout
|
||||
|
||||
|
@ -1,41 +1,36 @@
|
||||
#coding:utf-8
|
||||
#
|
||||
# id: bugs.core_1510
|
||||
# title: Bad XSQLVAR [NULL flags] for (2*COALESCE(NULL,NULL))
|
||||
# decription:
|
||||
# tracker_id: CORE-1510
|
||||
# min_versions: ['2.1.7']
|
||||
# versions: 3.0
|
||||
# qmid: None
|
||||
|
||||
"""
|
||||
ID: issue-19285
|
||||
ISSUE: 19285
|
||||
TITLE: Bad XSQLVAR [NULL flags] for (2*COALESCE(NULL,NULL))
|
||||
DESCRIPTION:
|
||||
JIRA: CORE-1510
|
||||
"""
|
||||
|
||||
import pytest
|
||||
from firebird.qa import db_factory, isql_act, Action
|
||||
from firebird.qa import *
|
||||
|
||||
# version: 3.0
|
||||
# resources: None
|
||||
db = db_factory()
|
||||
|
||||
substitutions_1 = [('^((?!sqltype).)*$', ''), ('[ ]+', ' '), ('[\t]*', ' '), ('charset:.*', '')]
|
||||
|
||||
init_script_1 = """"""
|
||||
|
||||
db_1 = db_factory(page_size=4096, sql_dialect=3, init=init_script_1)
|
||||
|
||||
test_script_1 = """
|
||||
test_script = """
|
||||
set sqlda_display;
|
||||
select 2*COALESCE(NULL,NULL) from RDB$DATABASE;
|
||||
select 2*IIF(NULL is NULL, NULL, NULL) from RDB$DATABASE;
|
||||
"""
|
||||
|
||||
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
|
||||
act = isql_act('db', test_script,
|
||||
substitutions=[('^((?!sqltype).)*$', ''), ('[ ]+', ' '),
|
||||
('[\t]*', ' '), ('charset:.*', '')])
|
||||
|
||||
expected_stdout_1 = """
|
||||
expected_stdout = """
|
||||
01: sqltype: 580 INT64 Nullable scale: 0 subtype: 0 len: 8
|
||||
01: sqltype: 580 INT64 Nullable scale: 0 subtype: 0 len: 8
|
||||
"""
|
||||
|
||||
@pytest.mark.version('>=3.0')
|
||||
def test_1(act_1: Action):
|
||||
act_1.expected_stdout = expected_stdout_1
|
||||
act_1.execute()
|
||||
assert act_1.clean_stdout == act_1.clean_expected_stdout
|
||||
def test_1(act: Action):
|
||||
act.expected_stdout = expected_stdout
|
||||
act.execute()
|
||||
assert act.clean_stdout == act.clean_expected_stdout
|
||||
|
||||
|
@ -1,44 +1,36 @@
|
||||
#coding:utf-8
|
||||
#
|
||||
# id: bugs.core_1511
|
||||
# title: POSITION(string_exp1, string_exp2 [, start])
|
||||
# decription:
|
||||
# tracker_id: CORE-1511
|
||||
# min_versions: ['2.1.0']
|
||||
# versions: 2.1.0
|
||||
# qmid: None
|
||||
|
||||
"""
|
||||
ID: issue-1926
|
||||
ISSUE: 1926
|
||||
TITLE: POSITION(string_exp1, string_exp2 [, start])
|
||||
DESCRIPTION:
|
||||
JIRA: CORE-1511
|
||||
"""
|
||||
|
||||
import pytest
|
||||
from firebird.qa import db_factory, isql_act, Action
|
||||
from firebird.qa import *
|
||||
|
||||
# version: 2.1.0
|
||||
# resources: None
|
||||
db = db_factory()
|
||||
|
||||
substitutions_1 = []
|
||||
|
||||
init_script_1 = """"""
|
||||
|
||||
db_1 = db_factory(page_size=4096, sql_dialect=3, init=init_script_1)
|
||||
|
||||
test_script_1 = """SELECT position ('be', 'To be or not to be')
|
||||
test_script = """SELECT position ('be', 'To be or not to be')
|
||||
,position ('be', 'To be or not to be', 4)
|
||||
,position ('be', 'To be or not to be', 8)
|
||||
,position ('be', 'To be or not to be', 18)
|
||||
FROM RDB$DATABASE;"""
|
||||
|
||||
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
|
||||
act = isql_act('db', test_script)
|
||||
|
||||
expected_stdout_1 = """Database: localhost:C:\\fbtest2\\tmp\\bugs.core_1511.fdb, User: SYSDBA
|
||||
SQL> CON> CON> CON> CON>
|
||||
expected_stdout = """
|
||||
POSITION POSITION POSITION POSITION
|
||||
============ ============ ============ ============
|
||||
4 4 17 0
|
||||
|
||||
SQL>"""
|
||||
"""
|
||||
|
||||
@pytest.mark.version('>=2.1.0')
|
||||
def test_1(act_1: Action):
|
||||
act_1.expected_stdout = expected_stdout_1
|
||||
act_1.execute()
|
||||
assert act_1.clean_stdout == act_1.clean_expected_stdout
|
||||
def test_1(act: Action):
|
||||
act.expected_stdout = expected_stdout
|
||||
act.execute()
|
||||
assert act.clean_stdout == act.clean_expected_stdout
|
||||
|
||||
|
@ -1,74 +1,67 @@
|
||||
#coding:utf-8
|
||||
#
|
||||
# id: bugs.core_1512
|
||||
# title: Connection lost running script
|
||||
# decription:
|
||||
# tracker_id: CORE-1512
|
||||
# min_versions: ['2.5.0']
|
||||
# versions: 2.5
|
||||
# qmid: None
|
||||
|
||||
"""
|
||||
ID: issue-1928
|
||||
ISSUE: 1928
|
||||
TITLE: Connection lost running script
|
||||
DESCRIPTION:
|
||||
JIRA: CORE-1512
|
||||
"""
|
||||
|
||||
import pytest
|
||||
from firebird.qa import db_factory, isql_act, Action
|
||||
from firebird.qa import *
|
||||
|
||||
# version: 2.5
|
||||
# resources: None
|
||||
db = db_factory(charset='ISO8859_1')
|
||||
|
||||
substitutions_1 = []
|
||||
|
||||
init_script_1 = """"""
|
||||
|
||||
db_1 = db_factory(page_size=4096, charset='ISO8859_1', sql_dialect=3, init=init_script_1)
|
||||
|
||||
test_script_1 = """
|
||||
test_script = """
|
||||
-- Confirmed crash on WI-V2.1.7.18553 for: CREATE TABLE FHO_OS(...)
|
||||
|
||||
CREATE DOMAIN DM_COD AS
|
||||
NUMERIC(4,0);
|
||||
|
||||
|
||||
CREATE DOMAIN DM_COD2 AS
|
||||
NUMERIC(8,0);
|
||||
|
||||
|
||||
CREATE DOMAIN DM_DES AS
|
||||
VARCHAR(80)
|
||||
COLLATE PT_PT;
|
||||
|
||||
|
||||
CREATE DOMAIN DM_FONE AS
|
||||
VARCHAR(20)
|
||||
COLLATE PT_PT;
|
||||
|
||||
|
||||
CREATE DOMAIN DM_ID AS
|
||||
NUMERIC(4,0);
|
||||
|
||||
|
||||
CREATE DOMAIN DM_ID2 AS
|
||||
NUMERIC(8,0);
|
||||
|
||||
|
||||
CREATE DOMAIN DM_IMG AS
|
||||
BLOB SUB_TYPE 0 SEGMENT SIZE 4096;
|
||||
|
||||
|
||||
CREATE DOMAIN DM_IND AS
|
||||
CHAR(1)
|
||||
COLLATE PT_PT;
|
||||
|
||||
|
||||
CREATE DOMAIN DM_IND2 AS
|
||||
CHAR(2)
|
||||
COLLATE PT_PT;
|
||||
|
||||
|
||||
CREATE DOMAIN DM_NM AS
|
||||
VARCHAR(80)
|
||||
COLLATE PT_PT;
|
||||
|
||||
|
||||
CREATE DOMAIN DM_PWS AS
|
||||
VARCHAR(10)
|
||||
COLLATE PT_PT;
|
||||
|
||||
|
||||
CREATE DOMAIN DM_TP AS
|
||||
CHAR(1)
|
||||
COLLATE PT_PT;
|
||||
|
||||
|
||||
CREATE DOMAIN DM_TXT AS
|
||||
BLOB SUB_TYPE 1 SEGMENT SIZE 4096;
|
||||
|
||||
|
||||
CREATE TABLE FHO_ATIV_TEC (
|
||||
COD_USUARIO DM_COD NOT NULL,
|
||||
DT_INICIO TIMESTAMP NOT NULL,
|
||||
@ -76,7 +69,7 @@ test_script_1 = """
|
||||
COD_ATIVIDADE DM_COD2 NOT NULL,
|
||||
ID_OS DM_ID2
|
||||
);
|
||||
|
||||
|
||||
CREATE TABLE FHO_OS (
|
||||
ID_OS DM_ID2 NOT NULL,
|
||||
DT_INICIO TIMESTAMP NOT NULL,
|
||||
@ -117,10 +110,11 @@ test_script_1 = """
|
||||
|
||||
"""
|
||||
|
||||
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
|
||||
|
||||
|
||||
@pytest.mark.version('>=2.5')
|
||||
def test_1(act_1: Action):
|
||||
act_1.execute()
|
||||
act = isql_act('db', test_script)
|
||||
|
||||
@pytest.mark.version('>=3')
|
||||
def test_1(act: Action):
|
||||
try:
|
||||
act.execute()
|
||||
except ExecutionError as e:
|
||||
pytest.fail("Test script execution failed", pytrace=False)
|
||||
|
@ -1,26 +1,19 @@
|
||||
#coding:utf-8
|
||||
#
|
||||
# id: bugs.core_1514
|
||||
# title: Many new 2.1 built in functions have incorrect NULL semantics
|
||||
# decription:
|
||||
# tracker_id: CORE-1514
|
||||
# min_versions: []
|
||||
# versions: 2.5
|
||||
# qmid: bugs.core_1514
|
||||
|
||||
"""
|
||||
ID: issue-1930
|
||||
ISSUE: 1930
|
||||
TITLE: Many new 2.1 built in functions have incorrect NULL semantics
|
||||
DESCRIPTION:
|
||||
JIRA: CORE-1514
|
||||
"""
|
||||
|
||||
import pytest
|
||||
from firebird.qa import db_factory, isql_act, Action
|
||||
from firebird.qa import *
|
||||
|
||||
# version: 2.5
|
||||
# resources: None
|
||||
db = db_factory()
|
||||
|
||||
substitutions_1 = []
|
||||
|
||||
init_script_1 = """"""
|
||||
|
||||
db_1 = db_factory(sql_dialect=3, init=init_script_1)
|
||||
|
||||
test_script_1 = """SELECT ABS(null) from rdb$database;
|
||||
test_script = """SELECT ABS(null) from rdb$database;
|
||||
SELECT ACOS(null) from rdb$database;
|
||||
SELECT ASCII_VAL(null) from rdb$database;
|
||||
SELECT ASIN(null) from rdb$database;
|
||||
@ -46,9 +39,9 @@ SELECT TAN(null) from rdb$database;
|
||||
SELECT TANH(null) from rdb$database;
|
||||
select trunc(1, cast(null as integer)) from rdb$database;"""
|
||||
|
||||
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
|
||||
act = isql_act('db', test_script)
|
||||
|
||||
expected_stdout_1 = """
|
||||
expected_stdout = """
|
||||
ABS
|
||||
============
|
||||
<null>
|
||||
@ -175,9 +168,9 @@ ASCII_VAL
|
||||
|
||||
"""
|
||||
|
||||
@pytest.mark.version('>=2.5')
|
||||
def test_1(act_1: Action):
|
||||
act_1.expected_stdout = expected_stdout_1
|
||||
act_1.execute()
|
||||
assert act_1.clean_stdout == act_1.clean_expected_stdout
|
||||
@pytest.mark.version('>=3')
|
||||
def test_1(act: Action):
|
||||
act.expected_stdout = expected_stdout
|
||||
act.execute()
|
||||
assert act.clean_stdout == act.clean_expected_stdout
|
||||
|
||||
|
@ -1,22 +1,17 @@
|
||||
#coding:utf-8
|
||||
#
|
||||
# id: bugs.core_1518
|
||||
# title: Adding a non-null restricted column to a populated table renders the table inconsistent
|
||||
# decription:
|
||||
# tracker_id: CORE-1518
|
||||
# min_versions: ['3.0']
|
||||
# versions: 3.0
|
||||
# qmid: None
|
||||
|
||||
"""
|
||||
ID: issue-789
|
||||
ISSUE: 789
|
||||
TITLE: Adding a non-null restricted column to a populated table renders the table inconsistent
|
||||
DESCRIPTION:
|
||||
JIRA: CORE-1518
|
||||
"""
|
||||
|
||||
import pytest
|
||||
from firebird.qa import db_factory, isql_act, Action
|
||||
from firebird.qa import *
|
||||
|
||||
# version: 3.0
|
||||
# resources: None
|
||||
|
||||
substitutions_1 = []
|
||||
|
||||
init_script_1 = """
|
||||
init_script = """
|
||||
-- Tests that manipulates with NULL fields/domains and check results:
|
||||
-- CORE-1518 Adding a non-null restricted column to a populated table renders the table inconsistent
|
||||
-- CORE-4453 (Regression: NOT NULL constraint, declared in domain, does not work)
|
||||
@ -29,9 +24,9 @@ init_script_1 = """
|
||||
commit;
|
||||
"""
|
||||
|
||||
db_1 = db_factory(page_size=4096, sql_dialect=3, init=init_script_1)
|
||||
db = db_factory(init=init_script)
|
||||
|
||||
test_script_1 = """
|
||||
test_script = """
|
||||
-- Source sample in the ticket:
|
||||
-- create table dyd(c1 integer), insert one record with value = 1.
|
||||
-- alter table dyd add c2 integer not null ==> did not raise exception but should.
|
||||
@ -47,9 +42,9 @@ test_script_1 = """
|
||||
-- alter table test add constraint test_nn check(c1 is not null); -- :(((
|
||||
"""
|
||||
|
||||
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
|
||||
act = isql_act('db', test_script)
|
||||
|
||||
expected_stderr_1 = """
|
||||
expected_stderr = """
|
||||
Statement failed, SQLSTATE = 22006
|
||||
unsuccessful metadata update
|
||||
-Cannot make field C1 of table TEST NOT NULL because there are NULLs present
|
||||
@ -57,19 +52,19 @@ expected_stderr_1 = """
|
||||
Statement failed, SQLSTATE = 22006
|
||||
unsuccessful metadata update
|
||||
-Cannot make field C1 of table TEST NOT NULL because there are NULLs present
|
||||
|
||||
|
||||
Statement failed, SQLSTATE = 22006
|
||||
unsuccessful metadata update
|
||||
-Cannot make field C2 of table TEST NOT NULL because there are NULLs present
|
||||
|
||||
|
||||
Statement failed, SQLSTATE = 22006
|
||||
unsuccessful metadata update
|
||||
-Cannot make field C3 of table TEST NOT NULL because there are NULLs present
|
||||
"""
|
||||
|
||||
@pytest.mark.version('>=3.0')
|
||||
def test_1(act_1: Action):
|
||||
act_1.expected_stderr = expected_stderr_1
|
||||
act_1.execute()
|
||||
assert act_1.clean_stderr == act_1.clean_expected_stderr
|
||||
def test_1(act: Action):
|
||||
act.expected_stderr = expected_stderr
|
||||
act.execute()
|
||||
assert act.clean_stderr == act.clean_expected_stderr
|
||||
|
||||
|
@ -1,32 +1,25 @@
|
||||
#coding:utf-8
|
||||
#
|
||||
# id: bugs.core_1522
|
||||
# title: Inconsistent DATEDIFF behaviour
|
||||
# decription:
|
||||
# tracker_id: CORE-1522
|
||||
# min_versions: []
|
||||
# versions: 2.1
|
||||
# qmid: bugs.core_1522
|
||||
|
||||
"""
|
||||
ID: issue-1937
|
||||
ISSUE: 1937
|
||||
TITLE: Inconsistent DATEDIFF behaviour
|
||||
DESCRIPTION:
|
||||
JIRA: CORE-1522
|
||||
"""
|
||||
|
||||
import pytest
|
||||
from firebird.qa import db_factory, isql_act, Action
|
||||
from firebird.qa import *
|
||||
|
||||
# version: 2.1
|
||||
# resources: None
|
||||
db = db_factory()
|
||||
|
||||
substitutions_1 = []
|
||||
|
||||
init_script_1 = """"""
|
||||
|
||||
db_1 = db_factory(sql_dialect=3, init=init_script_1)
|
||||
|
||||
test_script_1 = """SELECT DATEDIFF(HOUR, CAST('01:59:59' AS TIME), CAST('02:59:58' AS TIME)) FROM RDB$DATABASE;
|
||||
test_script = """SELECT DATEDIFF(HOUR, CAST('01:59:59' AS TIME), CAST('02:59:58' AS TIME)) FROM RDB$DATABASE;
|
||||
SELECT DATEDIFF(HOUR, CAST('01:59:59' AS TIME), CAST('02:59:59' AS TIME)) FROM RDB$DATABASE;
|
||||
"""
|
||||
|
||||
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
|
||||
act = isql_act('db', test_script)
|
||||
|
||||
expected_stdout_1 = """
|
||||
expected_stdout = """
|
||||
DATEDIFF
|
||||
=====================
|
||||
1
|
||||
@ -38,9 +31,9 @@ expected_stdout_1 = """
|
||||
|
||||
"""
|
||||
|
||||
@pytest.mark.version('>=2.1')
|
||||
def test_1(act_1: Action):
|
||||
act_1.expected_stdout = expected_stdout_1
|
||||
act_1.execute()
|
||||
assert act_1.clean_stdout == act_1.clean_expected_stdout
|
||||
@pytest.mark.version('>=3')
|
||||
def test_1(act: Action):
|
||||
act.expected_stdout = expected_stdout
|
||||
act.execute()
|
||||
assert act.clean_stdout == act.clean_expected_stdout
|
||||
|
||||
|
@ -1,37 +1,30 @@
|
||||
#coding:utf-8
|
||||
#
|
||||
# id: bugs.core_1525
|
||||
# title: Computed field + index not working in WHERE
|
||||
# decription:
|
||||
# tracker_id:
|
||||
# min_versions: ['2.0.7']
|
||||
# versions: 2.0.7
|
||||
# qmid: bugs.core_1525
|
||||
|
||||
"""
|
||||
ID: issue-1939
|
||||
ISSUE: 1939
|
||||
TITLE: Computed field + index not working in WHERE
|
||||
DESCRIPTION:
|
||||
JIRA: CORE-1525
|
||||
"""
|
||||
|
||||
import pytest
|
||||
from firebird.qa import db_factory, isql_act, Action
|
||||
from firebird.qa import *
|
||||
|
||||
# version: 2.0.7
|
||||
# resources: None
|
||||
db = db_factory()
|
||||
|
||||
substitutions_1 = []
|
||||
|
||||
init_script_1 = """"""
|
||||
|
||||
db_1 = db_factory(sql_dialect=3, init=init_script_1)
|
||||
|
||||
test_script_1 = """
|
||||
test_script = """
|
||||
create table test_1 (
|
||||
id integer not null,
|
||||
last_day date,
|
||||
comp_last_day computed by (coalesce(last_day, cast('2999-12-31' as date)))
|
||||
);
|
||||
|
||||
|
||||
|
||||
|
||||
insert into test_1 values (1, '2007-10-10');
|
||||
insert into test_1 values (2, null);
|
||||
commit;
|
||||
|
||||
|
||||
set list on;
|
||||
|
||||
select *
|
||||
@ -47,18 +40,18 @@ test_script_1 = """
|
||||
where cast ('2007-09-09' as date) < comp_last_day;
|
||||
"""
|
||||
|
||||
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
|
||||
act = isql_act('db', test_script)
|
||||
|
||||
expected_stdout_1 = """
|
||||
expected_stdout = """
|
||||
ID 1
|
||||
LAST_DAY 2007-10-10
|
||||
COMP_LAST_DAY 2007-10-10
|
||||
ID 2
|
||||
LAST_DAY <null>
|
||||
COMP_LAST_DAY 2999-12-31
|
||||
|
||||
|
||||
PLAN (TEST_1 INDEX (IDX_1))
|
||||
|
||||
|
||||
ID 1
|
||||
LAST_DAY 2007-10-10
|
||||
COMP_LAST_DAY 2007-10-10
|
||||
@ -68,8 +61,8 @@ expected_stdout_1 = """
|
||||
"""
|
||||
|
||||
@pytest.mark.version('>=2.0.7')
|
||||
def test_1(act_1: Action):
|
||||
act_1.expected_stdout = expected_stdout_1
|
||||
act_1.execute()
|
||||
assert act_1.clean_stdout == act_1.clean_expected_stdout
|
||||
def test_1(act: Action):
|
||||
act.expected_stdout = expected_stdout
|
||||
act.execute()
|
||||
assert act.clean_stdout == act.clean_expected_stdout
|
||||
|
||||
|
@ -1,38 +1,31 @@
|
||||
#coding:utf-8
|
||||
#
|
||||
# id: bugs.core_1528
|
||||
# title: Functions DATEDIFF does not work in dialect 1
|
||||
# decription:
|
||||
# tracker_id: CORE-1528
|
||||
# min_versions: []
|
||||
# versions: 2.1
|
||||
# qmid: bugs.core_1528
|
||||
|
||||
"""
|
||||
ID: issue-1942
|
||||
ISSUE: 1942
|
||||
TITLE: Functions DATEDIFF does not work in dialect 1
|
||||
DESCRIPTION:
|
||||
JIRA: CORE-1528
|
||||
"""
|
||||
|
||||
import pytest
|
||||
from firebird.qa import db_factory, isql_act, Action
|
||||
from firebird.qa import *
|
||||
|
||||
# version: 2.1
|
||||
# resources: None
|
||||
db = db_factory(sql_dialect=1)
|
||||
|
||||
substitutions_1 = []
|
||||
test_script = """SELECT DATEDIFF(DAY, CAST('18.10.2007' AS TIMESTAMP), CAST('23.10.2007' AS TIMESTAMP)) FROM RDB$DATABASE;"""
|
||||
|
||||
init_script_1 = """"""
|
||||
act = isql_act('db', test_script)
|
||||
|
||||
db_1 = db_factory(sql_dialect=1, init=init_script_1)
|
||||
|
||||
test_script_1 = """SELECT DATEDIFF(DAY, CAST('18.10.2007' AS TIMESTAMP), CAST('23.10.2007' AS TIMESTAMP)) FROM RDB$DATABASE;"""
|
||||
|
||||
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
|
||||
|
||||
expected_stdout_1 = """
|
||||
DATEDIFF
|
||||
=======================
|
||||
5.000000000000000
|
||||
expected_stdout = """
|
||||
DATEDIFF
|
||||
=======================
|
||||
5.000000000000000
|
||||
"""
|
||||
|
||||
@pytest.mark.version('>=2.1')
|
||||
def test_1(act_1: Action):
|
||||
act_1.expected_stdout = expected_stdout_1
|
||||
act_1.execute()
|
||||
assert act_1.clean_stdout == act_1.clean_expected_stdout
|
||||
def test_1(act: Action):
|
||||
act.expected_stdout = expected_stdout
|
||||
act.execute()
|
||||
assert act.clean_stdout == act.clean_expected_stdout
|
||||
|
||||
|
@ -1,22 +1,17 @@
|
||||
#coding:utf-8
|
||||
#
|
||||
# id: bugs.core_1533
|
||||
# title: JOIN on first record of ordered derived table returns wrong record
|
||||
# decription:
|
||||
# tracker_id: CORE-1533
|
||||
# min_versions: []
|
||||
# versions: 2.0.4
|
||||
# qmid: bugs.core_1533
|
||||
|
||||
"""
|
||||
ID: issue-1950
|
||||
ISSUE: 1950
|
||||
TITLE: JOIN on first record of ordered derived table returns wrong record
|
||||
DESCRIPTION:
|
||||
JIRA: CORE-1533
|
||||
"""
|
||||
|
||||
import pytest
|
||||
from firebird.qa import db_factory, isql_act, Action
|
||||
from firebird.qa import *
|
||||
|
||||
# version: 2.0.4
|
||||
# resources: None
|
||||
|
||||
substitutions_1 = []
|
||||
|
||||
init_script_1 = """create table X (
|
||||
init_script = """create table X (
|
||||
ID integer,
|
||||
DAT DATE
|
||||
);
|
||||
@ -30,14 +25,14 @@ create index IDX_X on X (DAT);
|
||||
commit;
|
||||
"""
|
||||
|
||||
db_1 = db_factory(sql_dialect=3, init=init_script_1)
|
||||
db = db_factory(init=init_script)
|
||||
|
||||
test_script_1 = """select X2.ID, x1.ID,x2.dat from X as X2 left join (select first 1 X.ID from X order by X.DAT) X1 on X1.ID=X2.ID;
|
||||
test_script = """select X2.ID, x1.ID,x2.dat from X as X2 left join (select first 1 X.ID from X order by X.DAT) X1 on X1.ID=X2.ID;
|
||||
"""
|
||||
|
||||
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
|
||||
act = isql_act('db', test_script)
|
||||
|
||||
expected_stdout_1 = """
|
||||
expected_stdout = """
|
||||
ID ID DAT
|
||||
============ ============ ===========
|
||||
1 <null> 2006-05-16
|
||||
@ -47,9 +42,9 @@ expected_stdout_1 = """
|
||||
|
||||
"""
|
||||
|
||||
@pytest.mark.version('>=2.0.4')
|
||||
def test_1(act_1: Action):
|
||||
act_1.expected_stdout = expected_stdout_1
|
||||
act_1.execute()
|
||||
assert act_1.clean_stdout == act_1.clean_expected_stdout
|
||||
@pytest.mark.version('>=3')
|
||||
def test_1(act: Action):
|
||||
act.expected_stdout = expected_stdout
|
||||
act.execute()
|
||||
assert act.clean_stdout == act.clean_expected_stdout
|
||||
|
||||
|
@ -1,51 +1,17 @@
|
||||
#coding:utf-8
|
||||
#
|
||||
# id: bugs.core_1539
|
||||
# title: select * from rdb$triggers where rdb$trigger_source like 'CHECK%'
|
||||
# decription:
|
||||
# ::: NOTE :::
|
||||
# In order to check correctness of following statements under ISQL itself (NOT under fbt_run), do following:
|
||||
# 1) open some text editor that supports charset = win1251 and set encoding for new document = WIN1251
|
||||
# (e.g. in Notepad++ pull-down menu: "Encoding / Character sets / Cyrillic / Windows 1251")
|
||||
# 2) type text save to .sql
|
||||
# 3) open this .sql in FAR editor and ensure that letters are displayed as SINGLE-BYTE characters
|
||||
# 4) run isql -i <script_encoded_in_win1251.sql>
|
||||
# In order to run this script under fbt_run:
|
||||
# 1) open Notepad++ new .fbt document and set Encoding = "UTF8 without BOM"
|
||||
# 2) copy-paste text from <script_encoded_in_win1251.sql>, ensure that letters remains readable
|
||||
# (it should be pasted here in UTF8 encoding)
|
||||
# 3) add in `expected_stdout` section required output by copy-paste from result of isql -i <script_encoded_in_win1251.sql>
|
||||
# (it should be pasted here in UTF8 encoding)
|
||||
# 4) save .fbt and ensure that it was saved in UTF8 encoding, otherwise exeption like
|
||||
# "UnicodeDecodeError: 'utf8' codec can't decode byte 0xc3 in position 621: invalid continuation byte"
|
||||
# will raise.
|
||||
#
|
||||
#
|
||||
# 02-mar-2021. Re-implemented in ordeer to have ability to run this test on Linux.
|
||||
# We run 'init_script' using charset = utf8 but then run separate ISQL-process
|
||||
# with request to establish connection using charset = WIN1251.
|
||||
# Its output is redirected to separate files. File with results of errors (STDERR) must remain empty.
|
||||
# If it contain anything, we use codecs.open(..., 'r', 'cp1251') + encode('utf8') to display its content.
|
||||
#
|
||||
# Checked on:
|
||||
# * Windows: 4.0.0.2377, 3.0.8.33420, 2.5.9.27152
|
||||
# * Linux: 4.0.0.2377, 3.0.8.33415
|
||||
#
|
||||
#
|
||||
# tracker_id: CORE-1539
|
||||
# min_versions: ['2.1']
|
||||
# versions: 2.1
|
||||
# qmid: None
|
||||
|
||||
"""
|
||||
ID: issue-1957
|
||||
ISSUE: 1957
|
||||
TITLE: select * from rdb$triggers where rdb$trigger_source like 'CHECK%'
|
||||
DESCRIPTION:
|
||||
JIRA: CORE-1539
|
||||
"""
|
||||
|
||||
import pytest
|
||||
from firebird.qa import db_factory, isql_act, Action
|
||||
from firebird.qa import *
|
||||
|
||||
# version: 2.1
|
||||
# resources: None
|
||||
|
||||
substitutions_1 = [('RDB$TRIGGER_SOURCE.*', 'RDB$TRIGGER_SOURCE <VALUE>')]
|
||||
|
||||
init_script_1 = """
|
||||
init_script = """
|
||||
-- ### ONCE AGAIN ###
|
||||
-- 1) for checking this under ISQL following must be encoded in WIN1251
|
||||
-- 2) for running under fbt_run utility following must be encoded in UTF8.
|
||||
@ -66,90 +32,9 @@ init_script_1 = """
|
||||
commit;
|
||||
"""
|
||||
|
||||
db_1 = db_factory(charset='UTF8', sql_dialect=3, init=init_script_1)
|
||||
db = db_factory(charset='UTF8', init=init_script)
|
||||
|
||||
# test_script_1
|
||||
#---
|
||||
#
|
||||
# import os
|
||||
# import subprocess
|
||||
# import time
|
||||
# import codecs
|
||||
#
|
||||
# db_conn.close()
|
||||
#
|
||||
# #--------------------------------------------
|
||||
#
|
||||
# def flush_and_close( file_handle ):
|
||||
# # https://docs.python.org/2/library/os.html#os.fsync
|
||||
# # If you're starting with a Python file object f,
|
||||
# # first do f.flush(), and
|
||||
# # then do os.fsync(f.fileno()), to ensure that all internal buffers associated with f are written to disk.
|
||||
# global os
|
||||
#
|
||||
# file_handle.flush()
|
||||
# if file_handle.mode not in ('r', 'rb') and file_handle.name != os.devnull:
|
||||
# # otherwise: "OSError: [Errno 9] Bad file descriptor"!
|
||||
# os.fsync(file_handle.fileno())
|
||||
# file_handle.close()
|
||||
#
|
||||
# #--------------------------------------------
|
||||
#
|
||||
# def cleanup( f_names_list ):
|
||||
# global os
|
||||
# for i in range(len( f_names_list )):
|
||||
# if type(f_names_list[i]) == file:
|
||||
# del_name = f_names_list[i].name
|
||||
# elif type(f_names_list[i]) == str:
|
||||
# del_name = f_names_list[i]
|
||||
# else:
|
||||
# print('Unrecognized type of element:', f_names_list[i], ' - can not be treated as file.')
|
||||
# del_name = None
|
||||
#
|
||||
# if del_name and os.path.isfile( del_name ):
|
||||
# os.remove( del_name )
|
||||
#
|
||||
# #--------------------------------------------
|
||||
#
|
||||
#
|
||||
# sql_cmd='''
|
||||
# set names WIN1251;
|
||||
# connect '%(dsn)s' user '%(user_name)s' password '%(user_password)s';
|
||||
# set blob all;
|
||||
# set list on;
|
||||
# -- Ticket:
|
||||
# -- select * from rdb$triggers where rdb$trigger_source like 'CHECK%%' ==> "Cannot transliterate character between character sets."
|
||||
# -- select * from rdb$triggers where rdb$trigger_source starting 'CHECK' ==> works fine.
|
||||
# select rdb$trigger_name, rdb$trigger_source
|
||||
# from rdb$triggers
|
||||
# where rdb$trigger_source like 'check%%'
|
||||
# order by cast(replace(rdb$trigger_name, 'CHECK_', '') as int);
|
||||
# ;
|
||||
# ''' % dict(globals(), **locals())
|
||||
#
|
||||
# f_sql_chk = open( os.path.join(context['temp_directory'],'tmp_1539_run.sql'), 'w')
|
||||
# f_sql_chk.write(sql_cmd)
|
||||
# flush_and_close( f_sql_chk )
|
||||
#
|
||||
# f_sql_log = open( ''.join( (os.path.splitext(f_sql_chk.name)[0], '.log' ) ), 'w')
|
||||
# f_sql_err = open( ''.join( (os.path.splitext(f_sql_chk.name)[0], '.err' ) ), 'w')
|
||||
# subprocess.call( [ context['isql_path'], '-q', '-i', f_sql_chk.name ], stdout = f_sql_log, stderr = f_sql_err)
|
||||
# flush_and_close( f_sql_log )
|
||||
# flush_and_close( f_sql_err )
|
||||
#
|
||||
# # If any error occurs --> open .err file and convert messages from there (encoded in win1251) to utf-8:
|
||||
# #
|
||||
# with codecs.open(f_sql_err.name,'r', encoding='cp1251') as f:
|
||||
# for line in f:
|
||||
# if line:
|
||||
# print( 'Unexpected STDERR, line: %s' % line.encode('utf-8') )
|
||||
#
|
||||
# cleanup( (f_sql_chk, f_sql_log, f_sql_err) )
|
||||
#
|
||||
#
|
||||
#---
|
||||
|
||||
test_script_1 = """
|
||||
test_script = """
|
||||
set blob all;
|
||||
set list on;
|
||||
-- Ticket:
|
||||
@ -161,9 +46,10 @@ where rdb$trigger_source like 'check%%'
|
||||
order by cast(replace(rdb$trigger_name, 'CHECK_', '') as int);
|
||||
"""
|
||||
|
||||
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
|
||||
act = isql_act('db', test_script,
|
||||
substitutions=[('RDB$TRIGGER_SOURCE.*', 'RDB$TRIGGER_SOURCE <VALUE>')])
|
||||
|
||||
expected_stdout_1 = """
|
||||
expected_stdout = """
|
||||
|
||||
RDB$TRIGGER_NAME CHECK_1
|
||||
RDB$TRIGGER_SOURCE 0:b
|
||||
@ -198,10 +84,10 @@ RDB$TRIGGER_SOURCE 0:20
|
||||
check ((decision = 'адкрыта' and fixerkey is null and decisiondate is null) or (decision <> 'адкрыта' and not fixerkey is null and not decisiondate is null))
|
||||
"""
|
||||
|
||||
@pytest.mark.version('>=2.1')
|
||||
def test_1(act_1: Action):
|
||||
act_1.expected_stdout = expected_stdout_1
|
||||
act_1.execute(charset='WIN1251')
|
||||
assert act_1.clean_stdout == act_1.clean_expected_stdout
|
||||
@pytest.mark.version('>=3')
|
||||
def test_1(act: Action):
|
||||
act.expected_stdout = expected_stdout
|
||||
act.execute(charset='WIN1251')
|
||||
assert act.clean_stdout == act.clean_expected_stdout
|
||||
|
||||
|
||||
|
@ -1,84 +1,65 @@
|
||||
#coding:utf-8
|
||||
#
|
||||
# id: bugs.core_1544
|
||||
# title: RDB$procedures generator overflow
|
||||
# decription:
|
||||
# New URL: https://github.com/FirebirdSQL/firebird/issues/1961
|
||||
#
|
||||
# Re-implemented in order to generate SQL script with more than 32K create/drop procedures.
|
||||
# Total number of created procedures is set by 'TOTAL_PROCEDURES_COUNT' variable.
|
||||
#
|
||||
# In order to reduce time:
|
||||
# * FW is changed OFF
|
||||
# * test uses LOCAL connection protocol
|
||||
# Confirmed bug on 2.0.6.13266, got:
|
||||
# Statement failed, SQLCODE = -607
|
||||
# unsuccessful metadata update
|
||||
# -STORE RDB$PROCEDURES failed
|
||||
# -arithmetic exception, numeric overflow, or string truncation
|
||||
# -At trigger 'RDB$TRIGGER_28'
|
||||
# (value of gen_id(rdb$procedures,0) is 32768 when this error raises)
|
||||
#
|
||||
# Checked on:
|
||||
# 5.0.0.43 SS: 153.655s.
|
||||
# 5.0.0.40 CS: 159.848s.
|
||||
# 4.0.0.2491 SS: 156.878s.
|
||||
# 4.0.0.2489 CS: 157.147s.
|
||||
# 3.0.8.33468 SS: 174.331s.
|
||||
# 3.0.8.33452 CS: 150.367s.
|
||||
#
|
||||
# tracker_id: CORE-1544
|
||||
# min_versions: ['2.5.0']
|
||||
# versions: 2.5
|
||||
# qmid:
|
||||
|
||||
"""
|
||||
ID: issue-1961
|
||||
ISSUE: 1961
|
||||
TITLE: RDB$procedures generator overflow
|
||||
DESCRIPTION:
|
||||
Total number of created procedures is set by 'TOTAL_PROCEDURES_COUNT' variable.
|
||||
|
||||
In order to reduce time:
|
||||
* FW is changed OFF
|
||||
* test uses LOCAL connection protocol
|
||||
Confirmed bug on 2.0.6.13266, got:
|
||||
Statement failed, SQLCODE = -607
|
||||
unsuccessful metadata update
|
||||
-STORE RDB$PROCEDURES failed
|
||||
-arithmetic exception, numeric overflow, or string truncation
|
||||
-At trigger 'RDB$TRIGGER_28'
|
||||
(value of gen_id(rdb$procedures,0) is 32768 when this error raises)
|
||||
JIRA: CORE-1544
|
||||
"""
|
||||
|
||||
import pytest
|
||||
from firebird.qa import db_factory, python_act, Action
|
||||
from firebird.qa import *
|
||||
|
||||
# version: 2.5
|
||||
# resources: None
|
||||
db = db_factory()
|
||||
|
||||
substitutions_1 = []
|
||||
|
||||
init_script_1 = """"""
|
||||
|
||||
db_1 = db_factory(sql_dialect=3, init=init_script_1)
|
||||
|
||||
# test_script_1
|
||||
# test_script
|
||||
#---
|
||||
#
|
||||
#
|
||||
#
|
||||
#
|
||||
# import os
|
||||
# import subprocess
|
||||
# import time
|
||||
#
|
||||
#
|
||||
# os.environ["ISC_USER"] = user_name
|
||||
# os.environ["ISC_PASSWORD"] = user_password
|
||||
# db_name = db_conn.database_name
|
||||
# db_conn.close()
|
||||
# runProgram('gfix',[dsn,'-w','async'])
|
||||
#
|
||||
#
|
||||
# ############################
|
||||
# TOTAL_PROCEDURES_COUNT=32800
|
||||
# ############################
|
||||
#
|
||||
#
|
||||
# #--------------------------------------------
|
||||
#
|
||||
#
|
||||
# def flush_and_close( file_handle ):
|
||||
# # https://docs.python.org/2/library/os.html#os.fsync
|
||||
# # If you're starting with a Python file object f,
|
||||
# # first do f.flush(), and
|
||||
# # If you're starting with a Python file object f,
|
||||
# # first do f.flush(), and
|
||||
# # then do os.fsync(f.fileno()), to ensure that all internal buffers associated with f are written to disk.
|
||||
# global os
|
||||
#
|
||||
#
|
||||
# file_handle.flush()
|
||||
# if file_handle.mode not in ('r', 'rb') and file_handle.name != os.devnull:
|
||||
# # otherwise: "OSError: [Errno 9] Bad file descriptor"!
|
||||
# os.fsync(file_handle.fileno())
|
||||
# file_handle.close()
|
||||
#
|
||||
#
|
||||
# #--------------------------------------------
|
||||
#
|
||||
#
|
||||
# def cleanup( f_names_list ):
|
||||
# global os
|
||||
# for i in range(len( f_names_list )):
|
||||
@ -89,19 +70,19 @@ db_1 = db_factory(sql_dialect=3, init=init_script_1)
|
||||
# else:
|
||||
# print('Unrecognized type of element:', f_names_list[i], ' - can not be treated as file.')
|
||||
# del_name = None
|
||||
#
|
||||
#
|
||||
# if del_name and os.path.isfile( del_name ):
|
||||
# os.remove( del_name )
|
||||
#
|
||||
#
|
||||
# #--------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#
|
||||
# script='''
|
||||
# set bail on;
|
||||
# set list on;
|
||||
# set term #;
|
||||
# '''
|
||||
#
|
||||
#
|
||||
# for i in range(1,TOTAL_PROCEDURES_COUNT+1):
|
||||
# script = '\\n'.join(
|
||||
# ( script
|
||||
@ -109,7 +90,7 @@ db_1 = db_factory(sql_dialect=3, init=init_script_1)
|
||||
# ,'drop procedure sp_%d#' % i
|
||||
# )
|
||||
# )
|
||||
#
|
||||
#
|
||||
# script = '\\n'.join(
|
||||
# ( script
|
||||
# ,"select iif( gen_id(rdb$procedures,0) >= %d, 'Expected.','UNEXPECTED: ' || gen_id(rdb$procedures,0) || ' - less then %d' ) as GEN_RDB_PROC_CURR_VALUE from rdb$database#" % (TOTAL_PROCEDURES_COUNT, TOTAL_PROCEDURES_COUNT)
|
||||
@ -118,49 +99,49 @@ db_1 = db_factory(sql_dialect=3, init=init_script_1)
|
||||
# ,'set term ;#'
|
||||
# )
|
||||
# )
|
||||
#
|
||||
#
|
||||
#
|
||||
#
|
||||
# f_isql_cmd=open(os.path.join(context['temp_directory'],'tmp_core_1544.sql'), 'w')
|
||||
# f_isql_cmd.write(script)
|
||||
# flush_and_close( f_isql_cmd )
|
||||
#
|
||||
#
|
||||
# f_isql_log=open(os.path.join(context['temp_directory'],'tmp_core_1544.log'),'w')
|
||||
# f_isql_err=open(os.path.join(context['temp_directory'],'tmp_core_1544.err'),'w')
|
||||
#
|
||||
#
|
||||
# # NB: use local connection here in order to increase speed:
|
||||
# subprocess.call([ context['isql_path'], db_name, "-i", f_isql_cmd.name],stdout = f_isql_log, stderr = f_isql_err)
|
||||
#
|
||||
#
|
||||
# flush_and_close( f_isql_log )
|
||||
# flush_and_close( f_isql_err )
|
||||
#
|
||||
#
|
||||
# with open(f_isql_err.name,'r') as f:
|
||||
# for line in f:
|
||||
# if line.split():
|
||||
# print('UNEXPECTED STDERR: ' + line.strip())
|
||||
#
|
||||
#
|
||||
# with open(f_isql_log.name,'r') as f:
|
||||
# for line in f:
|
||||
# if line.split():
|
||||
# print(line.strip())
|
||||
#
|
||||
#
|
||||
#
|
||||
#
|
||||
# # cleanup:
|
||||
# ##########
|
||||
# time.sleep(1)
|
||||
# cleanup((f_isql_cmd, f_isql_log, f_isql_err))
|
||||
#
|
||||
#
|
||||
#---
|
||||
|
||||
act_1 = python_act('db_1', substitutions=substitutions_1)
|
||||
act = python_act('db')
|
||||
|
||||
expected_stdout_1 = """
|
||||
expected_stdout = """
|
||||
GEN_RDB_PROC_CURR_VALUE Expected.
|
||||
R -9876543321
|
||||
"""
|
||||
|
||||
@pytest.mark.version('>=2.5')
|
||||
@pytest.mark.version('>=3')
|
||||
@pytest.mark.xfail
|
||||
def test_1(act_1: Action):
|
||||
def test_1(act: Action):
|
||||
pytest.fail("Test not IMPLEMENTED")
|
||||
|
||||
|
||||
|
@ -1,33 +1,26 @@
|
||||
#coding:utf-8
|
||||
#
|
||||
# id: bugs.core_1549
|
||||
# title: Subquery-based predicates are not evaluated early in the join order
|
||||
# decription:
|
||||
# tracker_id: CORE-1549
|
||||
# min_versions: []
|
||||
# versions: 3.0
|
||||
# qmid: bugs.core_1549
|
||||
|
||||
"""
|
||||
ID: issue-1966
|
||||
ISSUE: 1966
|
||||
TITLE: Subquery-based predicates are not evaluated early in the join order
|
||||
DESCRIPTION:
|
||||
JIRA: CORE-1549
|
||||
"""
|
||||
|
||||
import pytest
|
||||
from firebird.qa import db_factory, isql_act, Action
|
||||
from firebird.qa import *
|
||||
|
||||
# version: 3.0
|
||||
# resources: None
|
||||
db = db_factory()
|
||||
|
||||
substitutions_1 = []
|
||||
|
||||
init_script_1 = """"""
|
||||
|
||||
db_1 = db_factory(page_size=4096, sql_dialect=3, init=init_script_1)
|
||||
|
||||
test_script_1 = """
|
||||
test_script = """
|
||||
recreate table t(id int);
|
||||
commit;
|
||||
insert into t select row_number()over() from rdb$types a, (select 1 i from rdb$types rows 4) b rows 1000;
|
||||
commit;
|
||||
create index t_id on t(id);
|
||||
commit;
|
||||
|
||||
|
||||
-- Query-1:
|
||||
set list on;
|
||||
select '' as "EXISTS with ref. to 1st stream:" from rdb$database;
|
||||
@ -45,7 +38,7 @@ test_script_1 = """
|
||||
set planonly;
|
||||
set plan off;
|
||||
set explain off;
|
||||
|
||||
|
||||
select '' as "Two sep. DT and EXISTS inside:" from rdb$database;
|
||||
|
||||
set planonly;
|
||||
@ -69,11 +62,11 @@ test_script_1 = """
|
||||
on b.id >= a.id;
|
||||
"""
|
||||
|
||||
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
|
||||
act = isql_act('db', test_script)
|
||||
|
||||
expected_stdout_1 = """
|
||||
expected_stdout = """
|
||||
EXISTS with ref. to 1st stream:
|
||||
|
||||
|
||||
Select Expression
|
||||
-> Filter
|
||||
-> Table "T" as "X" Access By ID
|
||||
@ -92,10 +85,10 @@ expected_stdout_1 = """
|
||||
-> Table "T" as "B" Access By ID
|
||||
-> Bitmap
|
||||
-> Index "T_ID" Range Scan (lower bound: 1/1)
|
||||
|
||||
|
||||
|
||||
Two sep. DT and EXISTS inside:
|
||||
|
||||
|
||||
Select Expression
|
||||
-> Filter
|
||||
-> Table "T" as "B X" Access By ID
|
||||
@ -117,8 +110,8 @@ expected_stdout_1 = """
|
||||
"""
|
||||
|
||||
@pytest.mark.version('>=3.0')
|
||||
def test_1(act_1: Action):
|
||||
act_1.expected_stdout = expected_stdout_1
|
||||
act_1.execute()
|
||||
assert act_1.clean_stdout == act_1.clean_expected_stdout
|
||||
def test_1(act: Action):
|
||||
act.expected_stdout = expected_stdout
|
||||
act.execute()
|
||||
assert act.clean_stdout == act.clean_expected_stdout
|
||||
|
||||
|
@ -1,37 +1,19 @@
|
||||
#coding:utf-8
|
||||
#
|
||||
# id: bugs.core_1550_postfix
|
||||
# title: Unnecessary index scan happens when the same index is mapped to both WHERE and ORDER BY clauses
|
||||
# decription:
|
||||
# http://sourceforge.net/p/firebird/code/60368
|
||||
# Date: 2014-12-16 11:40:42 +0000 (Tue, 16 Dec 2014)
|
||||
#
|
||||
# First letter to dimitr: 30.09.2014 20:01.
|
||||
# Reproduced on 3.0.0.31472 Beta 2 (10.dec.2014).
|
||||
# Checked on:
|
||||
# 3.0.3.32837: OK, 1.516s.
|
||||
# 3.0.3.32838: OK, 0.953s.
|
||||
# 4.0.0.800: OK, 1.625s.
|
||||
# 4.0.0.801: OK, 1.125s.
|
||||
#
|
||||
# tracker_id:
|
||||
# min_versions: ['3.0']
|
||||
# versions: 3.0
|
||||
# qmid:
|
||||
|
||||
"""
|
||||
ID: issue-1967-postfix
|
||||
ISSUE: 1967
|
||||
TITLE: Unnecessary index scan happens when the same index is mapped to both WHERE and ORDER BY clauses
|
||||
DESCRIPTION:
|
||||
JIRA: CORE-1550
|
||||
"""
|
||||
|
||||
import pytest
|
||||
from firebird.qa import db_factory, isql_act, Action
|
||||
from firebird.qa import *
|
||||
|
||||
# version: 3.0
|
||||
# resources: None
|
||||
db = db_factory()
|
||||
|
||||
substitutions_1 = []
|
||||
|
||||
init_script_1 = """"""
|
||||
|
||||
db_1 = db_factory(sql_dialect=3, init=init_script_1)
|
||||
|
||||
test_script_1 = """
|
||||
test_script = """
|
||||
-- sent to dimitr 30.09.14 at 22:09
|
||||
set term ^;
|
||||
execute block as
|
||||
@ -61,7 +43,7 @@ test_script_1 = """
|
||||
select *
|
||||
from tm m
|
||||
where exists(
|
||||
select * from td d where m.id = d.id
|
||||
select * from td d where m.id = d.id
|
||||
order by d.id --------------------------- ### this "useless" order by should prevent from bitmap creation in 3.0+
|
||||
);
|
||||
-- Ineffective plan was here:
|
||||
@ -69,13 +51,13 @@ test_script_1 = """
|
||||
-- ... ^
|
||||
-- |
|
||||
-- +-----> BITMAP created!
|
||||
|
||||
|
||||
-- 2. Check for usage when fields from UNIQUE index are involved:
|
||||
select *
|
||||
from tm m
|
||||
where exists(
|
||||
select * from td d
|
||||
where m.id = d.f01 and d.f02 = 10
|
||||
select * from td d
|
||||
where m.id = d.f01 and d.f02 = 10
|
||||
order by d.f01, d.f02 ------------------- ### this "useless" order by should prevent from bitmap creation in 3.0+
|
||||
);
|
||||
|
||||
@ -86,9 +68,9 @@ test_script_1 = """
|
||||
-- +-----> BITMAP created!
|
||||
"""
|
||||
|
||||
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
|
||||
act = isql_act('db', test_script)
|
||||
|
||||
expected_stdout_1 = """
|
||||
expected_stdout = """
|
||||
PLAN (D ORDER TD_PK)
|
||||
PLAN (M NATURAL)
|
||||
|
||||
@ -97,8 +79,8 @@ expected_stdout_1 = """
|
||||
"""
|
||||
|
||||
@pytest.mark.version('>=3.0')
|
||||
def test_1(act_1: Action):
|
||||
act_1.expected_stdout = expected_stdout_1
|
||||
act_1.execute()
|
||||
assert act_1.clean_stdout == act_1.clean_expected_stdout
|
||||
def test_1(act: Action):
|
||||
act.expected_stdout = expected_stdout
|
||||
act.execute()
|
||||
assert act.clean_stdout == act.clean_expected_stdout
|
||||
|
||||
|
@ -1,26 +1,19 @@
|
||||
#coding:utf-8
|
||||
#
|
||||
# id: bugs.core_1550
|
||||
# title: Unnecessary index scan happens when the same index is mapped to both WHERE and ORDER BY clauses
|
||||
# decription:
|
||||
# tracker_id:
|
||||
# min_versions: ['3.0']
|
||||
# versions: 3.0
|
||||
# qmid: bugs.core_1550
|
||||
|
||||
"""
|
||||
ID: issue-1967
|
||||
ISSUE: 1967
|
||||
TITLE: Unnecessary index scan happens when the same index is mapped to both WHERE and ORDER BY clauses
|
||||
DESCRIPTION:
|
||||
JIRA: CORE-1550
|
||||
"""
|
||||
|
||||
import pytest
|
||||
from firebird.qa import db_factory, isql_act, Action
|
||||
from firebird.qa import *
|
||||
|
||||
# version: 3.0
|
||||
# resources: None
|
||||
db = db_factory()
|
||||
|
||||
substitutions_1 = []
|
||||
|
||||
init_script_1 = """"""
|
||||
|
||||
db_1 = db_factory(sql_dialect=3, init=init_script_1)
|
||||
|
||||
test_script_1 = """
|
||||
test_script = """
|
||||
recreate table test(id int);
|
||||
commit;
|
||||
insert into test(id) select r.rdb$relation_id from rdb$relations r;
|
||||
@ -35,15 +28,15 @@ test_script_1 = """
|
||||
order by id;
|
||||
"""
|
||||
|
||||
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
|
||||
act = isql_act('db', test_script)
|
||||
|
||||
expected_stdout_1 = """
|
||||
expected_stdout = """
|
||||
PLAN (TEST ORDER TEST_ID)
|
||||
"""
|
||||
|
||||
@pytest.mark.version('>=3.0')
|
||||
def test_1(act_1: Action):
|
||||
act_1.expected_stdout = expected_stdout_1
|
||||
act_1.execute()
|
||||
assert act_1.clean_stdout == act_1.clean_expected_stdout
|
||||
def test_1(act: Action):
|
||||
act.expected_stdout = expected_stdout
|
||||
act.execute()
|
||||
assert act.clean_stdout == act.clean_expected_stdout
|
||||
|
||||
|
@ -1,43 +1,36 @@
|
||||
#coding:utf-8
|
||||
#
|
||||
# id: bugs.core_1551
|
||||
# title: AV when all statements are cancelled
|
||||
# decription:
|
||||
# tracker_id: CORE-1551
|
||||
# min_versions: []
|
||||
# versions: 2.5.0
|
||||
# qmid: bugs.core_1551-250
|
||||
|
||||
"""
|
||||
ID: issue-1968
|
||||
ISSUE: 1968
|
||||
TITLE: AV when all statements are cancelled
|
||||
DESCRIPTION:
|
||||
JIRA: CORE-1551
|
||||
"""
|
||||
|
||||
import pytest
|
||||
from firebird.qa import db_factory, isql_act, Action
|
||||
from firebird.qa import *
|
||||
|
||||
# version: 2.5.0
|
||||
# resources: None
|
||||
db = db_factory()
|
||||
|
||||
substitutions_1 = []
|
||||
|
||||
init_script_1 = """"""
|
||||
|
||||
db_1 = db_factory(sql_dialect=3, init=init_script_1)
|
||||
|
||||
test_script_1 = """delete from MON$STATEMENTS;
|
||||
test_script = """delete from MON$STATEMENTS;
|
||||
delete from MON$ATTACHMENTS;
|
||||
COMMIT;
|
||||
SELECT 1 FROM RDB$DATABASE;
|
||||
"""
|
||||
|
||||
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
|
||||
act = isql_act('db', test_script)
|
||||
|
||||
expected_stdout_1 = """
|
||||
expected_stdout = """
|
||||
CONSTANT
|
||||
============
|
||||
1
|
||||
|
||||
"""
|
||||
|
||||
@pytest.mark.version('>=2.5.0')
|
||||
def test_1(act_1: Action):
|
||||
act_1.expected_stdout = expected_stdout_1
|
||||
act_1.execute()
|
||||
assert act_1.clean_stdout == act_1.clean_expected_stdout
|
||||
@pytest.mark.version('>=3')
|
||||
def test_1(act: Action):
|
||||
act.expected_stdout = expected_stdout
|
||||
act.execute()
|
||||
assert act.clean_stdout == act.clean_expected_stdout
|
||||
|
||||
|
@ -1,26 +1,19 @@
|
||||
#coding:utf-8
|
||||
#
|
||||
# id: bugs.core_1554
|
||||
# title: select ... where ... <> ALL (select ... join ...) bug
|
||||
# decription:
|
||||
# tracker_id:
|
||||
# min_versions: ['2.1.7']
|
||||
# versions: 2.1.7
|
||||
# qmid: bugs.core_1554
|
||||
|
||||
"""
|
||||
ID: issue-1971
|
||||
ISSUE: 1971
|
||||
TITLE: select ... where ... <> ALL (select ... join ...) bug
|
||||
DESCRIPTION:
|
||||
JIRA: CORE-1554
|
||||
"""
|
||||
|
||||
import pytest
|
||||
from firebird.qa import db_factory, isql_act, Action
|
||||
from firebird.qa import *
|
||||
|
||||
# version: 2.1.7
|
||||
# resources: None
|
||||
db = db_factory()
|
||||
|
||||
substitutions_1 = []
|
||||
|
||||
init_script_1 = """"""
|
||||
|
||||
db_1 = db_factory(sql_dialect=3, init=init_script_1)
|
||||
|
||||
test_script_1 = """
|
||||
test_script = """
|
||||
set list on;
|
||||
select
|
||||
(
|
||||
@ -43,15 +36,15 @@ test_script_1 = """
|
||||
from rdb$database;
|
||||
"""
|
||||
|
||||
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
|
||||
act = isql_act('db', test_script)
|
||||
|
||||
expected_stdout_1 = """
|
||||
expected_stdout = """
|
||||
CNT 0
|
||||
"""
|
||||
|
||||
@pytest.mark.version('>=2.1.7')
|
||||
def test_1(act_1: Action):
|
||||
act_1.expected_stdout = expected_stdout_1
|
||||
act_1.execute()
|
||||
assert act_1.clean_stdout == act_1.clean_expected_stdout
|
||||
@pytest.mark.version('>=3')
|
||||
def test_1(act: Action):
|
||||
act.expected_stdout = expected_stdout
|
||||
act.execute()
|
||||
assert act.clean_stdout == act.clean_expected_stdout
|
||||
|
||||
|
@ -1,26 +1,19 @@
|
||||
#coding:utf-8
|
||||
#
|
||||
# id: bugs.core_1555
|
||||
# title: 'select ...from...where...not in (select...from...)' no results
|
||||
# decription:
|
||||
# tracker_id:
|
||||
# min_versions: ['2.1.7']
|
||||
# versions: 2.1.7
|
||||
# qmid: bugs.core_1555
|
||||
|
||||
"""
|
||||
ID: issue-1972
|
||||
ISSUE: 1972
|
||||
TITLE: 'select ...from...where...not in (select...from...)' no results
|
||||
DESCRIPTION:
|
||||
JIRA: CORE-1555
|
||||
"""
|
||||
|
||||
import pytest
|
||||
from firebird.qa import db_factory, isql_act, Action
|
||||
from firebird.qa import *
|
||||
|
||||
# version: 2.1.7
|
||||
# resources: None
|
||||
db = db_factory()
|
||||
|
||||
substitutions_1 = []
|
||||
|
||||
init_script_1 = """"""
|
||||
|
||||
db_1 = db_factory(sql_dialect=3, init=init_script_1)
|
||||
|
||||
test_script_1 = """
|
||||
test_script = """
|
||||
set term ^ ;
|
||||
create or alter procedure tst1 returns (boxes integer) as
|
||||
begin
|
||||
@ -32,17 +25,17 @@ test_script_1 = """
|
||||
^
|
||||
set term ;^
|
||||
commit;
|
||||
|
||||
|
||||
recreate table frrates1 (
|
||||
frrates1 integer not null,
|
||||
boxes integer,
|
||||
primary key(frrates1)
|
||||
);
|
||||
commit;
|
||||
|
||||
|
||||
create index idx_frrates1_boxes on frrates1 (boxes);
|
||||
commit;
|
||||
|
||||
|
||||
recreate table schedpkgs1 (
|
||||
schedpkgs1 integer not null,
|
||||
schedule integer,
|
||||
@ -50,15 +43,15 @@ test_script_1 = """
|
||||
primary key (schedpkgs1)
|
||||
);
|
||||
commit;
|
||||
|
||||
|
||||
create index idx_schedpkgs1_schedule on schedpkgs1 (schedule);
|
||||
commit;
|
||||
|
||||
|
||||
|
||||
|
||||
insert into frrates1 (frrates1, boxes) values (11, 1);
|
||||
insert into frrates1 (frrates1, boxes) values (12, 2);
|
||||
commit;
|
||||
|
||||
|
||||
insert into schedpkgs1 (schedpkgs1, schedule, frrates1) values(21, 16651, 11);
|
||||
insert into schedpkgs1 (schedpkgs1, schedule, frrates1) values(22, 16651, null);
|
||||
commit;
|
||||
@ -71,31 +64,31 @@ test_script_1 = """
|
||||
from schedpkgs1 sp
|
||||
join frrates1 fr on fr.frrates1=sp.frrates1
|
||||
where sp.schedule = 16651;
|
||||
|
||||
|
||||
|
||||
|
||||
select boxes
|
||||
from tst1
|
||||
where boxes not in (select fr.boxes
|
||||
from schedpkgs1 sp
|
||||
join frrates1 fr on fr.frrates1=sp.frrates1
|
||||
where sp.schedule = 16651);
|
||||
|
||||
|
||||
|
||||
|
||||
select boxes
|
||||
from tst1
|
||||
where boxes not in (select fr.boxes
|
||||
from schedpkgs1 sp
|
||||
join frrates1 fr on fr.frrates1=sp.frrates1
|
||||
where sp.schedule = 16651 and fr.boxes>0);
|
||||
|
||||
|
||||
|
||||
|
||||
select f2.boxes
|
||||
from frrates1 f2
|
||||
where f2.boxes not in (select fr.boxes
|
||||
from schedpkgs1 sp
|
||||
join frrates1 fr on fr.frrates1=sp.frrates1
|
||||
where sp.schedule = 16651);
|
||||
|
||||
|
||||
select f2.boxes
|
||||
from frrates1 f2
|
||||
where f2.boxes not in (select fr.boxes
|
||||
@ -104,9 +97,9 @@ test_script_1 = """
|
||||
where sp.schedule = 16651 and fr.boxes>0);
|
||||
"""
|
||||
|
||||
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
|
||||
act = isql_act('db', test_script)
|
||||
|
||||
expected_stdout_1 = """
|
||||
expected_stdout = """
|
||||
BOXES 1
|
||||
BOXES 2
|
||||
BOXES 2
|
||||
@ -114,9 +107,9 @@ expected_stdout_1 = """
|
||||
BOXES 2
|
||||
"""
|
||||
|
||||
@pytest.mark.version('>=2.1.7')
|
||||
def test_1(act_1: Action):
|
||||
act_1.expected_stdout = expected_stdout_1
|
||||
act_1.execute()
|
||||
assert act_1.clean_stdout == act_1.clean_expected_stdout
|
||||
@pytest.mark.version('>=3')
|
||||
def test_1(act: Action):
|
||||
act.expected_stdout = expected_stdout
|
||||
act.execute()
|
||||
assert act.clean_stdout == act.clean_expected_stdout
|
||||
|
||||
|
@ -1,26 +1,19 @@
|
||||
#coding:utf-8
|
||||
#
|
||||
# id: bugs.core_1559
|
||||
# title: Dropping NOT NULL contranint doesn'have the desired effect
|
||||
# decription:
|
||||
# tracker_id: CORE-1559
|
||||
# min_versions: []
|
||||
# versions: 2.5.3
|
||||
# qmid: bugs.core_1559-250
|
||||
|
||||
"""
|
||||
ID: issue-1978
|
||||
ISSUE: 1978
|
||||
TITLE: Dropping NOT NULL contranint doesn'have the desired effect
|
||||
DESCRIPTION:
|
||||
JIRA: CORE-1559
|
||||
"""
|
||||
|
||||
import pytest
|
||||
from firebird.qa import db_factory, isql_act, Action
|
||||
from firebird.qa import *
|
||||
|
||||
# version: 2.5.3
|
||||
# resources: None
|
||||
db = db_factory()
|
||||
|
||||
substitutions_1 = []
|
||||
|
||||
init_script_1 = """"""
|
||||
|
||||
db_1 = db_factory(sql_dialect=3, init=init_script_1)
|
||||
|
||||
test_script_1 = """create table t (n integer constraint c not null);
|
||||
test_script = """create table t (n integer constraint c not null);
|
||||
COMMIT;
|
||||
insert into t values (null);
|
||||
COMMIT;
|
||||
@ -31,24 +24,24 @@ COMMIT;
|
||||
SELECT * FROM t;
|
||||
"""
|
||||
|
||||
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
|
||||
act = isql_act('db', test_script)
|
||||
|
||||
expected_stdout_1 = """Database: localhost:C:\\Users\\win7\\Firebird_tests\\fbt-repository\\tmp\\bugs.core_1559.fdb, User: SYSDBA
|
||||
SQL> SQL> SQL> SQL> SQL> SQL> SQL> SQL> SQL>
|
||||
expected_stdout = """
|
||||
N
|
||||
============
|
||||
<null>
|
||||
|
||||
SQL>"""
|
||||
expected_stderr_1 = """Statement failed, SQLSTATE = 23000
|
||||
"""
|
||||
|
||||
expected_stderr = """Statement failed, SQLSTATE = 23000
|
||||
validation error for column "T"."N", value "*** null ***"
|
||||
"""
|
||||
|
||||
@pytest.mark.version('>=2.5.3')
|
||||
def test_1(act_1: Action):
|
||||
act_1.expected_stdout = expected_stdout_1
|
||||
act_1.expected_stderr = expected_stderr_1
|
||||
act_1.execute()
|
||||
assert act_1.clean_stderr == act_1.clean_expected_stderr
|
||||
assert act_1.clean_stdout == act_1.clean_expected_stdout
|
||||
@pytest.mark.version('>=3')
|
||||
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)
|
||||
|
||||
|
@ -1,40 +1,33 @@
|
||||
#coding:utf-8
|
||||
#
|
||||
# id: bugs.core_1560
|
||||
# title: NULLIF crashes when first parameter is constant empty string
|
||||
# decription:
|
||||
# tracker_id:
|
||||
# min_versions: []
|
||||
# versions: 2.1
|
||||
# qmid: bugs.core_1560
|
||||
|
||||
import pytest
|
||||
from firebird.qa import db_factory, isql_act, Action
|
||||
|
||||
# version: 2.1
|
||||
# resources: None
|
||||
|
||||
substitutions_1 = []
|
||||
|
||||
init_script_1 = """"""
|
||||
|
||||
db_1 = db_factory(sql_dialect=3, init=init_script_1)
|
||||
|
||||
test_script_1 = """select nullif('','') from rdb$database;
|
||||
"""
|
||||
ID: issue-1979
|
||||
ISSUE: 1979
|
||||
TITLE: NULLIF crashes when first parameter is constant empty string
|
||||
DESCRIPTION:
|
||||
JIRA: CORE-1560
|
||||
"""
|
||||
|
||||
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
|
||||
import pytest
|
||||
from firebird.qa import *
|
||||
|
||||
expected_stdout_1 = """
|
||||
db = db_factory()
|
||||
|
||||
test_script = """select nullif('','') from rdb$database;
|
||||
"""
|
||||
|
||||
act = isql_act('db', test_script)
|
||||
|
||||
expected_stdout = """
|
||||
CASE
|
||||
======
|
||||
<null>
|
||||
|
||||
"""
|
||||
|
||||
@pytest.mark.version('>=2.1')
|
||||
def test_1(act_1: Action):
|
||||
act_1.expected_stdout = expected_stdout_1
|
||||
act_1.execute()
|
||||
assert act_1.clean_stdout == act_1.clean_expected_stdout
|
||||
@pytest.mark.version('>=3')
|
||||
def test_1(act: Action):
|
||||
act.expected_stdout = expected_stdout
|
||||
act.execute()
|
||||
assert act.clean_stdout == act.clean_expected_stdout
|
||||
|
||||
|
@ -1,22 +1,17 @@
|
||||
#coding:utf-8
|
||||
#
|
||||
# id: bugs.core_1572
|
||||
# title: Multiple Rows in Singleton Select not reported in a View
|
||||
# decription:
|
||||
# tracker_id: CORE-1572
|
||||
# min_versions: []
|
||||
# versions: 2.5.0
|
||||
# qmid: bugs.core_1572-250
|
||||
|
||||
"""
|
||||
ID: issue-1990
|
||||
ISSUE: 1990
|
||||
TITLE: Multiple Rows in Singleton Select not reported in a View
|
||||
DESCRIPTION:
|
||||
JIRA: CORE-1572
|
||||
"""
|
||||
|
||||
import pytest
|
||||
from firebird.qa import db_factory, isql_act, Action
|
||||
from firebird.qa import *
|
||||
|
||||
# version: 2.5.0
|
||||
# resources: None
|
||||
|
||||
substitutions_1 = []
|
||||
|
||||
init_script_1 = """CREATE TABLE TABLE1 ( ID1 INTEGER NOT NULL, FIELD1 VARCHAR(20));
|
||||
init_script = """CREATE TABLE TABLE1 ( ID1 INTEGER NOT NULL, FIELD1 VARCHAR(20));
|
||||
CREATE TABLE TABLE2 ( ID2 INTEGER NOT NULL, FIELD2 VARCHAR(20));
|
||||
|
||||
INSERT INTO TABLE1 (ID1, FIELD1) VALUES (1, 'ONE');
|
||||
@ -28,26 +23,27 @@ SELECT TABLE1.ID1, TABLE1.FIELD1, ( SELECT TABLE2.FIELD2 FROM TABLE2 ) FROM TABL
|
||||
COMMIT;
|
||||
"""
|
||||
|
||||
db_1 = db_factory(sql_dialect=3, init=init_script_1)
|
||||
db = db_factory(init=init_script)
|
||||
|
||||
test_script_1 = """SELECT * FROM VIEW_TABLE;
|
||||
test_script = """SELECT * FROM VIEW_TABLE;
|
||||
"""
|
||||
|
||||
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
|
||||
act = isql_act('db', test_script)
|
||||
|
||||
expected_stdout_1 = """
|
||||
expected_stdout = """
|
||||
ID1 FIELD1 FIELD2
|
||||
============ ==================== ====================
|
||||
"""
|
||||
expected_stderr_1 = """Statement failed, SQLSTATE = 21000
|
||||
|
||||
expected_stderr = """Statement failed, SQLSTATE = 21000
|
||||
multiple rows in singleton select
|
||||
"""
|
||||
|
||||
@pytest.mark.version('>=2.5.0')
|
||||
def test_1(act_1: Action):
|
||||
act_1.expected_stdout = expected_stdout_1
|
||||
act_1.expected_stderr = expected_stderr_1
|
||||
act_1.execute()
|
||||
assert act_1.clean_stderr == act_1.clean_expected_stderr
|
||||
assert act_1.clean_stdout == act_1.clean_expected_stdout
|
||||
@pytest.mark.version('>=3')
|
||||
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)
|
||||
|
||||
|
@ -1,26 +1,19 @@
|
||||
#coding:utf-8
|
||||
#
|
||||
# id: bugs.core_1582
|
||||
# title: ABS() rounds NUMERIC values
|
||||
# decription:
|
||||
# tracker_id: CORE-1582
|
||||
# min_versions: []
|
||||
# versions: 2.1
|
||||
# qmid: bugs.core_1582
|
||||
|
||||
"""
|
||||
ID: issue-2001
|
||||
ISSUE: 2001
|
||||
TITLE: ABS() rounds NUMERIC values
|
||||
DESCRIPTION:
|
||||
JIRA: CORE-1582
|
||||
"""
|
||||
|
||||
import pytest
|
||||
from firebird.qa import db_factory, isql_act, Action
|
||||
from firebird.qa import *
|
||||
|
||||
# version: 2.1
|
||||
# resources: None
|
||||
db = db_factory()
|
||||
|
||||
substitutions_1 = []
|
||||
|
||||
init_script_1 = """"""
|
||||
|
||||
db_1 = db_factory(sql_dialect=3, init=init_script_1)
|
||||
|
||||
test_script_1 = """SELECT
|
||||
test_script = """SELECT
|
||||
ABS(CAST(-1.98 AS NUMERIC(10,2))),
|
||||
ABS(CAST(-1.23 AS DECIMAL(10,2))),
|
||||
ABS(CAST(-1.98 AS NUMERIC(9,2))),
|
||||
@ -28,18 +21,18 @@ test_script_1 = """SELECT
|
||||
FROM RDB$DATABASE;
|
||||
"""
|
||||
|
||||
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
|
||||
act = isql_act('db', test_script)
|
||||
|
||||
expected_stdout_1 = """
|
||||
expected_stdout = """
|
||||
ABS ABS ABS ABS
|
||||
===================== ===================== ===================== =====================
|
||||
1.98 1.23 1.98 1.23
|
||||
|
||||
"""
|
||||
|
||||
@pytest.mark.version('>=2.1')
|
||||
def test_1(act_1: Action):
|
||||
act_1.expected_stdout = expected_stdout_1
|
||||
act_1.execute()
|
||||
assert act_1.clean_stdout == act_1.clean_expected_stdout
|
||||
@pytest.mark.version('>=3')
|
||||
def test_1(act: Action):
|
||||
act.expected_stdout = expected_stdout
|
||||
act.execute()
|
||||
assert act.clean_stdout == act.clean_expected_stdout
|
||||
|
||||
|
@ -1,26 +1,19 @@
|
||||
#coding:utf-8
|
||||
#
|
||||
# id: bugs.core_1584
|
||||
# title: Server crashed or bugcheck when inserting in monitoring tables.
|
||||
# decription:
|
||||
# tracker_id: CORE-1584
|
||||
# min_versions: []
|
||||
# versions: 2.5
|
||||
# qmid: bugs.core_1584-250
|
||||
|
||||
"""
|
||||
ID: issue-2004
|
||||
ISSUE: 2004
|
||||
TITLE: Server crashed or bugcheck when inserting in monitoring tables.
|
||||
DESCRIPTION:
|
||||
JIRA: CORE-1584
|
||||
"""
|
||||
|
||||
import pytest
|
||||
from firebird.qa import db_factory, isql_act, Action
|
||||
from firebird.qa import *
|
||||
|
||||
# version: 2.5
|
||||
# resources: None
|
||||
db = db_factory()
|
||||
|
||||
substitutions_1 = []
|
||||
|
||||
init_script_1 = """"""
|
||||
|
||||
db_1 = db_factory(sql_dialect=3, init=init_script_1)
|
||||
|
||||
test_script_1 = """
|
||||
test_script = """
|
||||
insert into mon$statements(
|
||||
mon$statement_id
|
||||
,mon$attachment_id
|
||||
@ -42,21 +35,22 @@ test_script_1 = """
|
||||
select 1 as x from rdb$database;
|
||||
"""
|
||||
|
||||
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
|
||||
act = isql_act('db', test_script)
|
||||
|
||||
expected_stdout_1 = """
|
||||
expected_stdout = """
|
||||
X 1
|
||||
"""
|
||||
expected_stderr_1 = """
|
||||
|
||||
expected_stderr = """
|
||||
Statement failed, SQLSTATE = 42000
|
||||
operation not supported
|
||||
"""
|
||||
|
||||
@pytest.mark.version('>=2.5')
|
||||
def test_1(act_1: Action):
|
||||
act_1.expected_stdout = expected_stdout_1
|
||||
act_1.expected_stderr = expected_stderr_1
|
||||
act_1.execute()
|
||||
assert act_1.clean_stderr == act_1.clean_expected_stderr
|
||||
assert act_1.clean_stdout == act_1.clean_expected_stdout
|
||||
@pytest.mark.version('>=3')
|
||||
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)
|
||||
|
||||
|
@ -1,28 +1,19 @@
|
||||
#coding:utf-8
|
||||
#
|
||||
# id: bugs.core_1592
|
||||
# title: Altering procedure parameters can lead to unrestorable database
|
||||
# decription:
|
||||
# Checked on 4.0.0.1193 - works OK (DOES raise error during compilation).
|
||||
#
|
||||
# tracker_id: CORE-1592
|
||||
# min_versions: ['4.0']
|
||||
# versions: 4.0
|
||||
# qmid: None
|
||||
|
||||
"""
|
||||
ID: issue-2013
|
||||
ISSUE: 2013
|
||||
TITLE: Altering procedure parameters can lead to unrestorable database
|
||||
DESCRIPTION:
|
||||
JIRA: CORE-1592
|
||||
"""
|
||||
|
||||
import pytest
|
||||
from firebird.qa import db_factory, isql_act, Action
|
||||
from firebird.qa import *
|
||||
|
||||
# version: 4.0
|
||||
# resources: None
|
||||
db = db_factory()
|
||||
|
||||
substitutions_1 = []
|
||||
|
||||
init_script_1 = """"""
|
||||
|
||||
db_1 = db_factory(sql_dialect=3, init=init_script_1)
|
||||
|
||||
test_script_1 = """
|
||||
test_script = """
|
||||
set bail on;
|
||||
set list on;
|
||||
set term ^;
|
||||
@ -32,7 +23,7 @@ test_script_1 = """
|
||||
^
|
||||
create or alter procedure p1 returns ( x1 integer ) as begin
|
||||
x1 = 10; suspend;
|
||||
end
|
||||
end
|
||||
^
|
||||
create or alter procedure p2 returns ( x1 integer ) as begin
|
||||
for select x1 from p1 into :x1 do suspend;
|
||||
@ -49,9 +40,9 @@ test_script_1 = """
|
||||
|
||||
"""
|
||||
|
||||
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
|
||||
act = isql_act('db', test_script)
|
||||
|
||||
expected_stderr_1 = """
|
||||
expected_stderr = """
|
||||
Statement failed, SQLSTATE = 42000
|
||||
unsuccessful metadata update
|
||||
-cannot delete
|
||||
@ -60,8 +51,8 @@ expected_stderr_1 = """
|
||||
"""
|
||||
|
||||
@pytest.mark.version('>=4.0')
|
||||
def test_1(act_1: Action):
|
||||
act_1.expected_stderr = expected_stderr_1
|
||||
act_1.execute()
|
||||
assert act_1.clean_stderr == act_1.clean_expected_stderr
|
||||
def test_1(act: Action):
|
||||
act.expected_stderr = expected_stderr
|
||||
act.execute()
|
||||
assert act.clean_stderr == act.clean_expected_stderr
|
||||
|
||||
|
@ -1,28 +1,21 @@
|
||||
#coding:utf-8
|
||||
#
|
||||
# id: bugs.core_1605
|
||||
# title: Bugcheck 232 (invalid operation) for an aggregated query
|
||||
# decription:
|
||||
# tracker_id: CORE-1605
|
||||
# min_versions: ['3.0']
|
||||
# versions: 3.0
|
||||
# qmid: None
|
||||
|
||||
"""
|
||||
ID: issue-2026
|
||||
ISSUE: 2026
|
||||
TITLE: Bugcheck 232 (invalid operation) for an aggregated query
|
||||
DESCRIPTION:
|
||||
JIRA: CORE-1605
|
||||
"""
|
||||
|
||||
import pytest
|
||||
from firebird.qa import db_factory, isql_act, Action
|
||||
from firebird.qa import *
|
||||
|
||||
# version: 3.0
|
||||
# resources: None
|
||||
db = db_factory()
|
||||
|
||||
substitutions_1 = []
|
||||
|
||||
init_script_1 = """"""
|
||||
|
||||
db_1 = db_factory(page_size=4096, sql_dialect=3, init=init_script_1)
|
||||
|
||||
test_script_1 = """
|
||||
test_script = """
|
||||
recreate table test (id int);
|
||||
|
||||
|
||||
set term ^;
|
||||
create or alter procedure sp_test (id int) returns (result int) as
|
||||
begin
|
||||
@ -30,15 +23,15 @@ test_script_1 = """
|
||||
suspend;
|
||||
end
|
||||
^
|
||||
|
||||
|
||||
set term ;^
|
||||
commit;
|
||||
|
||||
|
||||
insert into test values(1);
|
||||
insert into test values(2);
|
||||
insert into test values(3);
|
||||
commit;
|
||||
|
||||
|
||||
select
|
||||
sum( id ),
|
||||
sum( (select result from sp_test(id)) )
|
||||
@ -46,9 +39,9 @@ test_script_1 = """
|
||||
group by 2;
|
||||
"""
|
||||
|
||||
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
|
||||
act = isql_act('db', test_script)
|
||||
|
||||
expected_stderr_1 = """
|
||||
expected_stderr = """
|
||||
Statement failed, SQLSTATE = 42000
|
||||
Dynamic SQL Error
|
||||
-SQL error code = -104
|
||||
@ -56,8 +49,8 @@ expected_stderr_1 = """
|
||||
"""
|
||||
|
||||
@pytest.mark.version('>=3.0')
|
||||
def test_1(act_1: Action):
|
||||
act_1.expected_stderr = expected_stderr_1
|
||||
act_1.execute()
|
||||
assert act_1.clean_stderr == act_1.clean_expected_stderr
|
||||
def test_1(act: Action):
|
||||
act.expected_stderr = expected_stderr
|
||||
act.execute()
|
||||
assert act.clean_stderr == act.clean_expected_stderr
|
||||
|
||||
|
@ -1,38 +1,23 @@
|
||||
#coding:utf-8
|
||||
#
|
||||
# id: bugs.core_1606
|
||||
# title: Ability to insert child record if parent record is locked but foreign key target unchanged
|
||||
# decription:
|
||||
# Master table has two record, both are updated but without changing PK field.
|
||||
# Than we check that we CAN add rows in detail table with references to existed PK from main,
|
||||
# and even can change FK-values in these added rows, but can do it only with maintenance that
|
||||
# MAIN table's PK exists for new values in FK
|
||||
# Checked on:
|
||||
# 4.0.0.1635 SS: 1.598s.
|
||||
# 4.0.0.1633 CS: 1.883s.
|
||||
# 3.0.5.33180 SS: 1.077s.
|
||||
# 3.0.5.33178 CS: 1.391s.
|
||||
# 2.5.9.27119 SS: 0.347s.
|
||||
# 2.5.9.27146 SC: 0.352s.
|
||||
#
|
||||
# tracker_id: CORE-1606
|
||||
# min_versions: ['2.5.0']
|
||||
# versions: 2.5
|
||||
# qmid: None
|
||||
|
||||
"""
|
||||
ID: issue-2027
|
||||
ISSUE: 2027
|
||||
TITLE: Ability to insert child record if parent record is locked but foreign key target unchanged
|
||||
DESCRIPTION:
|
||||
Master table has two record, both are updated but without changing PK field.
|
||||
Than we check that we CAN add rows in detail table with references to existed PK from main,
|
||||
and even can change FK-values in these added rows, but can do it only with maintenance that
|
||||
MAIN table's PK exists for new values in FK
|
||||
JIRA: CORE-1606
|
||||
"""
|
||||
|
||||
import pytest
|
||||
from firebird.qa import db_factory, isql_act, Action
|
||||
from firebird.qa import *
|
||||
|
||||
# version: 2.5
|
||||
# resources: None
|
||||
db = db_factory()
|
||||
|
||||
substitutions_1 = []
|
||||
|
||||
init_script_1 = """"""
|
||||
|
||||
db_1 = db_factory(sql_dialect=3, init=init_script_1)
|
||||
|
||||
test_script_1 = """
|
||||
test_script = """
|
||||
set term ^;
|
||||
execute block as
|
||||
begin
|
||||
@ -53,19 +38,19 @@ test_script_1 = """
|
||||
insert into tmain(id, x) values(1, 100);
|
||||
insert into tmain(id, x) values(2, 200);
|
||||
commit;
|
||||
|
||||
|
||||
set list on;
|
||||
set transaction no wait;
|
||||
|
||||
|
||||
--set count on;
|
||||
update tmain set id = id, x = -x*10 where id=1;
|
||||
update tmain set id = id, x = -x*20 where id=2;
|
||||
|
||||
|
||||
set term ^;
|
||||
execute block returns(id int, pid int) as
|
||||
declare s varchar(1024);
|
||||
begin
|
||||
|
||||
|
||||
s = 'insert into tdetl(id, pid) select gen_id(g,1), cast( ? as int) from rdb$types rows 3';
|
||||
/*
|
||||
-- todo later, after fix CORE-4796
|
||||
@ -78,15 +63,15 @@ test_script_1 = """
|
||||
execute statement ( s ) ( 1 ) -------------------------------------- [1]: add rows with pid=1
|
||||
on external 'localhost:' || rdb$get_context('SYSTEM','DB_NAME')
|
||||
as user 'sysdba' password 'masterkey' role 'RCHILD';
|
||||
|
||||
|
||||
execute statement ( s ) ( 2 ) -------------------------------------- [2]: add rows with pid=2
|
||||
on external 'localhost:' || rdb$get_context('SYSTEM','DB_NAME')
|
||||
as user 'sysdba' password 'masterkey' role 'RCHILD';
|
||||
|
||||
|
||||
execute statement ('update tdetl set pid = 3 - pid') -- rows with pid=1 that were inserted on [1] will have pid=2 and vice versa
|
||||
on external 'localhost:' || rdb$get_context('SYSTEM','DB_NAME')
|
||||
as user 'sysdba' password 'masterkey' role 'RCHILD';
|
||||
|
||||
|
||||
for
|
||||
execute statement 'select id,pid from tdetl order by id'
|
||||
on external 'localhost:' || rdb$get_context('SYSTEM','DB_NAME')
|
||||
@ -94,7 +79,7 @@ test_script_1 = """
|
||||
into id,pid
|
||||
do
|
||||
suspend;
|
||||
|
||||
|
||||
end
|
||||
^
|
||||
set term ;^
|
||||
@ -113,13 +98,13 @@ test_script_1 = """
|
||||
-- SQLCODE: -901 / lock time-out on wait transaction / object <this_test_DB> is in use
|
||||
-- #############################################################################################
|
||||
delete from mon$attachments where mon$attachment_id != current_connection;
|
||||
commit;
|
||||
commit;
|
||||
|
||||
"""
|
||||
|
||||
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
|
||||
act = isql_act('db', test_script)
|
||||
|
||||
expected_stdout_1 = """
|
||||
expected_stdout = """
|
||||
ID 1
|
||||
PID 2
|
||||
ID 2
|
||||
@ -134,9 +119,9 @@ expected_stdout_1 = """
|
||||
PID 1
|
||||
"""
|
||||
|
||||
@pytest.mark.version('>=2.5')
|
||||
def test_1(act_1: Action):
|
||||
act_1.expected_stdout = expected_stdout_1
|
||||
act_1.execute()
|
||||
assert act_1.clean_stdout == act_1.clean_expected_stdout
|
||||
@pytest.mark.version('>=3')
|
||||
def test_1(act: Action):
|
||||
act.expected_stdout = expected_stdout
|
||||
act.execute()
|
||||
assert act.clean_stdout == act.clean_expected_stdout
|
||||
|
||||
|
@ -1,26 +1,19 @@
|
||||
#coding:utf-8
|
||||
#
|
||||
# id: bugs.core_1607
|
||||
# title: Correlated subquery is optimized badly if it depends on the union stream
|
||||
# decription:
|
||||
# tracker_id: CORE-1607
|
||||
# min_versions: ['2.1']
|
||||
# versions: 3.0
|
||||
# qmid: None
|
||||
|
||||
"""
|
||||
ID: issue-2028
|
||||
ISSUE: 2028
|
||||
TITLE: Correlated subquery is optimized badly if it depends on the union stream
|
||||
DESCRIPTION:
|
||||
JIRA: CORE-1607
|
||||
"""
|
||||
|
||||
import pytest
|
||||
from firebird.qa import db_factory, isql_act, Action
|
||||
from firebird.qa import *
|
||||
|
||||
# version: 3.0
|
||||
# resources: None
|
||||
db = db_factory()
|
||||
|
||||
substitutions_1 = []
|
||||
|
||||
init_script_1 = """"""
|
||||
|
||||
db_1 = db_factory(page_size=4096, sql_dialect=3, init=init_script_1)
|
||||
|
||||
test_script_1 = """SET PLANONLY ON;
|
||||
test_script = """SET PLANONLY ON;
|
||||
select 1
|
||||
from ( select rdb$relation_name, ( select 1 from rdb$database ) as c from rdb$relations ) r
|
||||
where exists ( select * from rdb$relation_fields f where f.rdb$relation_name = r.rdb$relation_name );
|
||||
@ -41,9 +34,9 @@ from (
|
||||
) d;
|
||||
"""
|
||||
|
||||
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
|
||||
act = isql_act('db', test_script)
|
||||
|
||||
expected_stdout_1 = """
|
||||
expected_stdout = """
|
||||
PLAN (R RDB$DATABASE NATURAL)
|
||||
PLAN (F INDEX (RDB$INDEX_4))
|
||||
PLAN (R RDB$RELATIONS NATURAL)
|
||||
@ -56,8 +49,8 @@ PLAN (D RDB$DATABASE NATURAL, D RDB$DATABASE NATURAL)
|
||||
"""
|
||||
|
||||
@pytest.mark.version('>=3.0')
|
||||
def test_1(act_1: Action):
|
||||
act_1.expected_stdout = expected_stdout_1
|
||||
act_1.execute()
|
||||
assert act_1.clean_stdout == act_1.clean_expected_stdout
|
||||
def test_1(act: Action):
|
||||
act.expected_stdout = expected_stdout
|
||||
act.execute()
|
||||
assert act.clean_stdout == act.clean_expected_stdout
|
||||
|
||||
|
@ -1,29 +1,22 @@
|
||||
#coding:utf-8
|
||||
#
|
||||
# id: bugs.core_1609
|
||||
# title: PSQL output parameter size limited
|
||||
# decription:
|
||||
# tracker_id: CORE-1609
|
||||
# min_versions: ['3.0.1']
|
||||
# versions: 3.0.1
|
||||
# qmid: None
|
||||
|
||||
"""
|
||||
ID: issue-2030
|
||||
ISSUE: 2030
|
||||
TITLE: PSQL output parameter size limited
|
||||
DESCRIPTION:
|
||||
JIRA: CORE-1609
|
||||
"""
|
||||
|
||||
import pytest
|
||||
from firebird.qa import db_factory, isql_act, Action
|
||||
from firebird.qa import *
|
||||
|
||||
# version: 3.0.1
|
||||
# resources: None
|
||||
db = db_factory()
|
||||
|
||||
substitutions_1 = []
|
||||
|
||||
init_script_1 = """"""
|
||||
|
||||
db_1 = db_factory(sql_dialect=3, init=init_script_1)
|
||||
|
||||
test_script_1 = """
|
||||
test_script = """
|
||||
set bail on;
|
||||
set term ^;
|
||||
|
||||
|
||||
create or alter procedure spro$parse_tag1 as begin end
|
||||
^
|
||||
create or alter procedure spro$parse_tag2 as begin end
|
||||
@ -32,7 +25,7 @@ test_script_1 = """
|
||||
^
|
||||
commit
|
||||
^
|
||||
|
||||
|
||||
execute block as
|
||||
begin
|
||||
execute statement 'drop domain spro$long_string';
|
||||
@ -41,12 +34,12 @@ test_script_1 = """
|
||||
^
|
||||
commit
|
||||
^
|
||||
|
||||
|
||||
create domain spro$long_string as varchar(32765) character set none collate none
|
||||
^
|
||||
commit
|
||||
^
|
||||
|
||||
|
||||
create or alter procedure spro$parse_tag1(
|
||||
str_in type of spro$long_string,
|
||||
delimeter varchar(10))
|
||||
@ -57,7 +50,7 @@ test_script_1 = """
|
||||
suspend;
|
||||
end
|
||||
^
|
||||
|
||||
|
||||
create or alter procedure spro$parse_tag2(
|
||||
str_in type of spro$long_string,
|
||||
delimeter varchar(10))
|
||||
@ -123,7 +116,7 @@ test_script_1 = """
|
||||
,str_out48 varchar(32765)
|
||||
,str_out49 varchar(32765)
|
||||
,str_out50 varchar(32765)
|
||||
) as
|
||||
) as
|
||||
begin
|
||||
suspend;
|
||||
end
|
||||
@ -132,10 +125,11 @@ test_script_1 = """
|
||||
commit;
|
||||
"""
|
||||
|
||||
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
|
||||
|
||||
act = isql_act('db', test_script)
|
||||
|
||||
@pytest.mark.version('>=3.0.1')
|
||||
def test_1(act_1: Action):
|
||||
act_1.execute()
|
||||
|
||||
def test_1(act: Action):
|
||||
try:
|
||||
act.execute()
|
||||
except ExecutionError as e:
|
||||
pytest.fail("Test script execution failed", pytrace=False)
|
||||
|
@ -1,28 +1,21 @@
|
||||
#coding:utf-8
|
||||
#
|
||||
# id: bugs.core_1619
|
||||
# title: Some aggregate functions does NOT support NULL-constant in 3-d dialect
|
||||
# decription:
|
||||
# tracker_id: CORE-1619
|
||||
# min_versions: ['3.0']
|
||||
# versions: 3.0
|
||||
# qmid: None
|
||||
|
||||
"""
|
||||
ID: issue-2040
|
||||
ISSUE: 2040
|
||||
TITLE: Some aggregate functions does NOT support NULL-constant in 3-d dialect
|
||||
DESCRIPTION:
|
||||
JIRA: CORE-1619
|
||||
"""
|
||||
|
||||
import pytest
|
||||
from firebird.qa import db_factory, isql_act, Action
|
||||
from firebird.qa import *
|
||||
|
||||
# version: 3.0
|
||||
# resources: None
|
||||
db = db_factory(sql_dialect=3)
|
||||
|
||||
substitutions_1 = []
|
||||
|
||||
init_script_1 = """"""
|
||||
|
||||
db_1 = db_factory(page_size=4096, sql_dialect=3, init=init_script_1)
|
||||
|
||||
test_script_1 = """
|
||||
test_script = """
|
||||
set list on;
|
||||
select
|
||||
select
|
||||
avg(null) as avg_for_null
|
||||
,sum(null) as sum_for_null
|
||||
,var_samp(null) as var_samp_for_null
|
||||
@ -35,9 +28,9 @@ test_script_1 = """
|
||||
from rdb$relations;
|
||||
"""
|
||||
|
||||
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
|
||||
act = isql_act('db', test_script)
|
||||
|
||||
expected_stdout_1 = """
|
||||
expected_stdout = """
|
||||
AVG_FOR_NULL <null>
|
||||
SUM_FOR_NULL <null>
|
||||
VAR_SAMP_FOR_NULL <null>
|
||||
@ -50,8 +43,8 @@ expected_stdout_1 = """
|
||||
"""
|
||||
|
||||
@pytest.mark.version('>=3.0')
|
||||
def test_1(act_1: Action):
|
||||
act_1.expected_stdout = expected_stdout_1
|
||||
act_1.execute()
|
||||
assert act_1.clean_stdout == act_1.clean_expected_stdout
|
||||
def test_1(act: Action):
|
||||
act.expected_stdout = expected_stdout
|
||||
act.execute()
|
||||
assert act.clean_stdout == act.clean_expected_stdout
|
||||
|
||||
|
@ -1,30 +1,23 @@
|
||||
#coding:utf-8
|
||||
#
|
||||
# id: bugs.core_1620
|
||||
# title: Incorrect error message (column number) if the empty SQL string is prepared
|
||||
# decription:
|
||||
# tracker_id: CORE-1620
|
||||
# min_versions: ['3.0']
|
||||
# versions: 3.0
|
||||
# qmid: None
|
||||
|
||||
"""
|
||||
ID: issue-2041
|
||||
ISSUE: 2041
|
||||
TITLE: Incorrect error message (column number) if the empty SQL string is prepared
|
||||
DESCRIPTION:
|
||||
JIRA: CORE-1620
|
||||
"""
|
||||
|
||||
import pytest
|
||||
from firebird.qa import db_factory, isql_act, Action
|
||||
from firebird.qa import *
|
||||
|
||||
# version: 3.0
|
||||
# resources: None
|
||||
db = db_factory()
|
||||
|
||||
substitutions_1 = [("-At procedure 'TEST_ES1' line:.*", '')]
|
||||
|
||||
init_script_1 = """"""
|
||||
|
||||
db_1 = db_factory(page_size=4096, sql_dialect=3, init=init_script_1)
|
||||
|
||||
test_script_1 = """
|
||||
test_script = """
|
||||
set term ^;
|
||||
create procedure test_es1 as
|
||||
begin
|
||||
execute statement '';
|
||||
create procedure test_es1 as
|
||||
begin
|
||||
execute statement '';
|
||||
end
|
||||
^
|
||||
set term ;^
|
||||
@ -32,9 +25,9 @@ test_script_1 = """
|
||||
execute procedure test_es1;
|
||||
"""
|
||||
|
||||
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
|
||||
act = isql_act('db', test_script, substitutions=[("-At procedure 'TEST_ES1' line:.*", '')])
|
||||
|
||||
expected_stderr_1 = """
|
||||
expected_stderr = """
|
||||
Statement failed, SQLSTATE = 42000
|
||||
Dynamic SQL Error
|
||||
-SQL error code = -104
|
||||
@ -43,8 +36,8 @@ expected_stderr_1 = """
|
||||
"""
|
||||
|
||||
@pytest.mark.version('>=3.0')
|
||||
def test_1(act_1: Action):
|
||||
act_1.expected_stderr = expected_stderr_1
|
||||
act_1.execute()
|
||||
assert act_1.clean_stderr == act_1.clean_expected_stderr
|
||||
def test_1(act: Action):
|
||||
act.expected_stderr = expected_stderr
|
||||
act.execute()
|
||||
assert act.clean_stderr == act.clean_expected_stderr
|
||||
|
||||
|
@ -1,26 +1,19 @@
|
||||
#coding:utf-8
|
||||
#
|
||||
# id: bugs.core_1624
|
||||
# title: MERGE not correctly worked with parameters in MATCHING clause
|
||||
# decription:
|
||||
# tracker_id: CORE-1624
|
||||
# min_versions: ['2.5.0']
|
||||
# versions: 2.5
|
||||
# qmid: None
|
||||
|
||||
"""
|
||||
ID: issue-2045
|
||||
ISSUE: 2045
|
||||
TITLE: MERGE not correctly worked with parameters in MATCHING clause
|
||||
DESCRIPTION:
|
||||
JIRA: CORE-1624
|
||||
"""
|
||||
|
||||
import pytest
|
||||
from firebird.qa import db_factory, isql_act, Action
|
||||
from firebird.qa import *
|
||||
|
||||
# version: 2.5
|
||||
# resources: None
|
||||
db = db_factory()
|
||||
|
||||
substitutions_1 = [('=.*', '')]
|
||||
|
||||
init_script_1 = """"""
|
||||
|
||||
db_1 = db_factory(page_size=4096, sql_dialect=3, init=init_script_1)
|
||||
|
||||
test_script_1 = """
|
||||
test_script = """
|
||||
recreate table src(id int, x int);
|
||||
recreate table tgt(id int, x int);
|
||||
commit;
|
||||
@ -31,7 +24,7 @@ test_script_1 = """
|
||||
commit;
|
||||
insert into tgt values(2, 10);
|
||||
insert into tgt values(3, 20);
|
||||
commit;
|
||||
commit;
|
||||
set term ^;
|
||||
execute block as
|
||||
declare v_stt varchar(255);
|
||||
@ -40,7 +33,7 @@ test_script_1 = """
|
||||
'merge into tgt t using src s on s.id = t.id '
|
||||
|| 'when matched then update set t.x = s.x + ?'
|
||||
|| 'when NOT matched then insert values(s.id, s.id + ?)';
|
||||
|
||||
|
||||
execute statement (v_stt) ( 1000, 20000 );
|
||||
end
|
||||
^
|
||||
@ -48,9 +41,9 @@ test_script_1 = """
|
||||
select * from tgt;
|
||||
"""
|
||||
|
||||
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
|
||||
act = isql_act('db', test_script, substitutions=[('=.*', '')])
|
||||
|
||||
expected_stdout_1 = """
|
||||
expected_stdout = """
|
||||
ID X
|
||||
============ ============
|
||||
2 1200
|
||||
@ -59,9 +52,9 @@ expected_stdout_1 = """
|
||||
4 20004
|
||||
"""
|
||||
|
||||
@pytest.mark.version('>=2.5')
|
||||
def test_1(act_1: Action):
|
||||
act_1.expected_stdout = expected_stdout_1
|
||||
act_1.execute()
|
||||
assert act_1.clean_stdout == act_1.clean_expected_stdout
|
||||
@pytest.mark.version('>=3')
|
||||
def test_1(act: Action):
|
||||
act.expected_stdout = expected_stdout
|
||||
act.execute()
|
||||
assert act.clean_stdout == act.clean_expected_stdout
|
||||
|
||||
|
@ -1,22 +1,9 @@
|
||||
#coding:utf-8
|
||||
#
|
||||
# id: bugs.core_1640
|
||||
# title: Create or Alter view
|
||||
# decription:
|
||||
# tracker_id: CORE-1640
|
||||
# min_versions: ['2.5.0']
|
||||
# versions: 2.5.0
|
||||
# qmid: None
|
||||
|
||||
import pytest
|
||||
from firebird.qa import db_factory, isql_act, Action
|
||||
|
||||
# version: 2.5.0
|
||||
# resources: None
|
||||
|
||||
substitutions_1 = []
|
||||
|
||||
init_script_1 = """create table users (
|
||||
init_script = """create table users (
|
||||
id integer,
|
||||
name varchar(20),
|
||||
passwd varchar(20)
|
||||
@ -24,9 +11,9 @@ init_script_1 = """create table users (
|
||||
|
||||
commit;"""
|
||||
|
||||
db_1 = db_factory(page_size=4096, sql_dialect=3, init=init_script_1)
|
||||
db = db_factory(init=init_script)
|
||||
|
||||
test_script_1 = """create or alter view v_users as
|
||||
test_script = """create or alter view v_users as
|
||||
select name from users;
|
||||
commit;
|
||||
show view v_users;
|
||||
@ -46,37 +33,36 @@ show view v_users_name;
|
||||
|
||||
"""
|
||||
|
||||
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
|
||||
act = isql_act('db', test_script)
|
||||
|
||||
expected_stdout_1 = """Database: localhost:C:\\fbtest2\\tmp\\bugs.core_1640.fdb, User: SYSDBA
|
||||
SQL> CON> SQL> SQL> NAME VARCHAR(20) Nullable
|
||||
expected_stdout = """ NAME VARCHAR(20) Nullable
|
||||
View Source:
|
||||
==== ======
|
||||
|
||||
select name from users
|
||||
SQL> CON> SQL> SQL> ID INTEGER Nullable
|
||||
ID INTEGER Nullable
|
||||
NAME VARCHAR(20) Nullable
|
||||
PASSWD VARCHAR(20) Nullable
|
||||
View Source:
|
||||
==== ======
|
||||
|
||||
select id, name, passwd from users
|
||||
SQL> CON> SQL> SQL> CON> SQL> SQL> ID INTEGER Nullable
|
||||
ID INTEGER Nullable
|
||||
NAME VARCHAR(20) Nullable
|
||||
View Source:
|
||||
==== ======
|
||||
|
||||
select id, name from users
|
||||
SQL> NAME VARCHAR(20) Nullable
|
||||
NAME VARCHAR(20) Nullable
|
||||
View Source:
|
||||
==== ======
|
||||
|
||||
select name from v_users
|
||||
SQL> SQL> SQL>"""
|
||||
"""
|
||||
|
||||
@pytest.mark.version('>=2.5.0')
|
||||
def test_1(act_1: Action):
|
||||
act_1.expected_stdout = expected_stdout_1
|
||||
act_1.execute()
|
||||
assert act_1.clean_stdout == act_1.clean_expected_stdout
|
||||
@pytest.mark.version('>=3')
|
||||
def test_1(act: Action):
|
||||
act.expected_stdout = expected_stdout
|
||||
act.execute()
|
||||
assert act.clean_stdout == act.clean_expected_stdout
|
||||
|
||||
|
@ -1,26 +1,19 @@
|
||||
#coding:utf-8
|
||||
#
|
||||
# id: bugs.core_1642
|
||||
# title: Non-privileged monitoring reports wrong attachment data
|
||||
# decription:
|
||||
# When non-SYSDBA user selects from MON$ATTACHMENTS and other attachments are active at this point,
|
||||
# the resulting rowset refers to a wrong attachment (the one with minimal ID) instead of the current attachment.
|
||||
# Checked on: 4.0.0.1635; 3.0.5.33180; 2.5.9.27119.
|
||||
#
|
||||
# tracker_id: CORE-1642
|
||||
# min_versions: ['2.5.0']
|
||||
# versions: 2.5
|
||||
# qmid: None
|
||||
|
||||
"""
|
||||
ID: issue-2067
|
||||
ISSUE: 2067
|
||||
TITLE: Non-privileged monitoring reports wrong attachment data
|
||||
DESCRIPTION:
|
||||
When non-SYSDBA user selects from MON$ATTACHMENTS and other attachments are active at this point,
|
||||
the resulting rowset refers to a wrong attachment (the one with minimal ID) instead of the current attachment.
|
||||
JIRA: CORE-1642
|
||||
"""
|
||||
|
||||
import pytest
|
||||
from firebird.qa import db_factory, python_act, Action, user_factory, User
|
||||
from firebird.qa import *
|
||||
|
||||
# version: 2.5
|
||||
# resources: None
|
||||
|
||||
substitutions_1 = []
|
||||
|
||||
init_script_1 = """
|
||||
init_script = """
|
||||
create or alter view v_my_attach as
|
||||
select current_user as who_am_i, iif(current_connection - mon$attachment_id = 0, 'OK.', 'BAD') as my_attach_id
|
||||
from mon$attachments;
|
||||
@ -30,65 +23,31 @@ init_script_1 = """
|
||||
commit;
|
||||
"""
|
||||
|
||||
db_1 = db_factory(sql_dialect=3, init=init_script_1)
|
||||
db = db_factory(init=init_script)
|
||||
|
||||
# test_script_1
|
||||
#---
|
||||
#
|
||||
# con1=fdb.connect( dsn = dsn, user = 'tmp$c1642_alan', password = '123')
|
||||
# con2=fdb.connect( dsn = dsn, user = 'tmp$c1642_john', password = '456')
|
||||
# con3=fdb.connect( dsn = dsn, user = 'tmp$c1642_mick', password = '789')
|
||||
#
|
||||
# cur1=con1.cursor()
|
||||
# cur2=con2.cursor()
|
||||
# cur3=con3.cursor()
|
||||
#
|
||||
# chk_sql='select who_am_i, my_attach_id from v_my_attach'
|
||||
# cur1.execute(chk_sql)
|
||||
# cur2.execute(chk_sql)
|
||||
# cur3.execute(chk_sql)
|
||||
#
|
||||
# for c in (cur1,cur2,cur3):
|
||||
# for r in c:
|
||||
# print(r[0],r[1])
|
||||
#
|
||||
# cur1.close()
|
||||
# cur2.close()
|
||||
# cur3.close()
|
||||
# con1.close()
|
||||
# con2.close()
|
||||
# con3.close()
|
||||
#
|
||||
# db_conn.execute_immediate('drop user tmp$c1642_alan')
|
||||
# db_conn.execute_immediate('drop user tmp$c1642_john')
|
||||
# db_conn.execute_immediate('drop user tmp$c1642_mick')
|
||||
# db_conn.commit()
|
||||
#
|
||||
#---
|
||||
act = python_act('db')
|
||||
|
||||
act_1 = python_act('db_1', substitutions=substitutions_1)
|
||||
|
||||
expected_stdout_1 = """
|
||||
expected_stdout = """
|
||||
TMP$C1642_ALAN OK.
|
||||
TMP$C1642_JOHN OK.
|
||||
TMP$C1642_MICK OK.
|
||||
"""
|
||||
|
||||
user_1 = user_factory('db_1', name='tmp$c1642_alan', password='123')
|
||||
user_2 = user_factory('db_1', name='tmp$c1642_john', password = '456')
|
||||
user_3 = user_factory('db_1', name='tmp$c1642_mick', password = '789')
|
||||
user_1 = user_factory('db', name='tmp$c1642_alan', password='123')
|
||||
user_2 = user_factory('db', name='tmp$c1642_john', password = '456')
|
||||
user_3 = user_factory('db', name='tmp$c1642_mick', password = '789')
|
||||
|
||||
@pytest.mark.version('>=2.5')
|
||||
def test_1(act_1: Action, user_1: User, user_2: User, user_3: User, capsys):
|
||||
act_1.expected_stdout = expected_stdout_1
|
||||
def test_1(act: Action, user_1: User, user_2: User, user_3: User, capsys):
|
||||
act.expected_stdout = expected_stdout
|
||||
for user in [user_1, user_2, user_3]:
|
||||
with act_1.db.connect(user=user.name, password=user.password) as con:
|
||||
with act.db.connect(user=user.name, password=user.password) as con:
|
||||
c = con.cursor()
|
||||
c.execute('select who_am_i, my_attach_id from v_my_attach')
|
||||
for row in c:
|
||||
print(row[0], row[1])
|
||||
act_1.stdout = capsys.readouterr().out
|
||||
assert act_1.clean_stdout == act_1.clean_expected_stdout
|
||||
act.stdout = capsys.readouterr().out
|
||||
assert act.clean_stdout == act.clean_expected_stdout
|
||||
|
||||
|
||||
|
||||
|
@ -1,22 +1,17 @@
|
||||
#coding:utf-8
|
||||
#
|
||||
# id: bugs.core_1649
|
||||
# title: AV when recursive query used MERGE JOIN in execution plan
|
||||
# decription:
|
||||
# tracker_id: CORE-1649
|
||||
# min_versions: []
|
||||
# versions: 2.1
|
||||
# qmid: bugs.core_1649
|
||||
|
||||
"""
|
||||
ID: issue-2073
|
||||
ISSUE: 2073
|
||||
TITLE: AV when recursive query used MERGE JOIN in execution plan
|
||||
DESCRIPTION:
|
||||
JIRA: CORE-1649
|
||||
"""
|
||||
|
||||
import pytest
|
||||
from firebird.qa import db_factory, isql_act, Action
|
||||
from firebird.qa import *
|
||||
|
||||
# version: 2.1
|
||||
# resources: None
|
||||
|
||||
substitutions_1 = []
|
||||
|
||||
init_script_1 = """CREATE TABLE XXX (
|
||||
init_script = """CREATE TABLE XXX (
|
||||
ID INTEGER,
|
||||
L INTEGER,
|
||||
R INTEGER,
|
||||
@ -78,9 +73,9 @@ INSERT INTO CON (TYP, XID) VALUES (1, 200053);
|
||||
|
||||
COMMIT;"""
|
||||
|
||||
db_1 = db_factory(sql_dialect=3, init=init_script_1)
|
||||
db = db_factory(init=init_script)
|
||||
|
||||
test_script_1 = """with recursive
|
||||
test_script = """with recursive
|
||||
downtree (lvl, id, l, r)
|
||||
as
|
||||
(-- base
|
||||
@ -100,9 +95,9 @@ as
|
||||
select * from downtree;
|
||||
"""
|
||||
|
||||
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
|
||||
act = isql_act('db', test_script)
|
||||
|
||||
expected_stdout_1 = """
|
||||
expected_stdout = """
|
||||
LVL ID L R
|
||||
============ ============ ============ ============
|
||||
-1 1 1 68
|
||||
@ -111,9 +106,9 @@ expected_stdout_1 = """
|
||||
|
||||
"""
|
||||
|
||||
@pytest.mark.version('>=2.1')
|
||||
def test_1(act_1: Action):
|
||||
act_1.expected_stdout = expected_stdout_1
|
||||
act_1.execute()
|
||||
assert act_1.clean_stdout == act_1.clean_expected_stdout
|
||||
@pytest.mark.version('>=3')
|
||||
def test_1(act: Action):
|
||||
act.expected_stdout = expected_stdout
|
||||
act.execute()
|
||||
assert act.clean_stdout == act.clean_expected_stdout
|
||||
|
||||
|
@ -1,44 +1,39 @@
|
||||
#coding:utf-8
|
||||
#
|
||||
# id: bugs.core_1650
|
||||
# title: Infinite row generation in "select gen_id(..) from rdb$database" with "group by"
|
||||
# decription:
|
||||
# tracker_id: CORE-1650
|
||||
# min_versions: []
|
||||
# versions: 2.5.0
|
||||
# qmid: None
|
||||
|
||||
"""
|
||||
ID: issue-2074
|
||||
ISSUE: 2074
|
||||
TITLE: Infinite row generation in "select gen_id(..) from rdb$database" with "group by"
|
||||
DESCRIPTION:
|
||||
JIRA: CORE-1650
|
||||
"""
|
||||
|
||||
import pytest
|
||||
from firebird.qa import db_factory, isql_act, Action
|
||||
from firebird.qa import *
|
||||
|
||||
# version: 2.5.0
|
||||
# resources: None
|
||||
|
||||
substitutions_1 = []
|
||||
|
||||
init_script_1 = """create generator g;
|
||||
init_script = """create generator g;
|
||||
commit;
|
||||
"""
|
||||
|
||||
db_1 = db_factory(page_size=4096, sql_dialect=3, init=init_script_1)
|
||||
db = db_factory(init=init_script)
|
||||
|
||||
test_script_1 = """select first 10 1, gen_id(g, 1 )
|
||||
test_script = """select first 10 1, gen_id(g, 1 )
|
||||
from rdb$database
|
||||
group by 1,2;
|
||||
"""
|
||||
|
||||
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
|
||||
act = isql_act('db', test_script)
|
||||
|
||||
expected_stdout_1 = """
|
||||
expected_stdout = """
|
||||
CONSTANT GEN_ID
|
||||
============ =====================
|
||||
1 3
|
||||
|
||||
"""
|
||||
|
||||
@pytest.mark.version('>=2.5.0')
|
||||
def test_1(act_1: Action):
|
||||
act_1.expected_stdout = expected_stdout_1
|
||||
act_1.execute()
|
||||
assert act_1.clean_stdout == act_1.clean_expected_stdout
|
||||
@pytest.mark.version('>=3')
|
||||
def test_1(act: Action):
|
||||
act.expected_stdout = expected_stdout
|
||||
act.execute()
|
||||
assert act.clean_stdout == act.clean_expected_stdout
|
||||
|
||||
|
@ -1,31 +1,24 @@
|
||||
#coding:utf-8
|
||||
#
|
||||
# id: bugs.core_1656
|
||||
# title: Ability to format UUID from char(16) OCTETS to human readable form and vice versa
|
||||
# decription:
|
||||
# tracker_id: CORE-1656
|
||||
# min_versions: ['2.5.0']
|
||||
# versions: 3.0
|
||||
# qmid: None
|
||||
|
||||
import pytest
|
||||
from firebird.qa import db_factory, isql_act, Action
|
||||
|
||||
# version: 3.0
|
||||
# resources: None
|
||||
|
||||
substitutions_1 = []
|
||||
|
||||
init_script_1 = """"""
|
||||
|
||||
db_1 = db_factory(page_size=4096, sql_dialect=3, init=init_script_1)
|
||||
|
||||
test_script_1 = """select uuid_to_char(char_to_uuid('93519227-8D50-4E47-81AA-8F6678C096A1')) from rdb$database;
|
||||
"""
|
||||
ID: issue-2080
|
||||
ISSUE: 2080
|
||||
TITLE: Ability to format UUID from char(16) OCTETS to human readable form and vice versa
|
||||
DESCRIPTION:
|
||||
JIRA: CORE-1656
|
||||
"""
|
||||
|
||||
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
|
||||
import pytest
|
||||
from firebird.qa import *
|
||||
|
||||
expected_stdout_1 = """
|
||||
db = db_factory()
|
||||
|
||||
test_script = """select uuid_to_char(char_to_uuid('93519227-8D50-4E47-81AA-8F6678C096A1')) from rdb$database;
|
||||
"""
|
||||
|
||||
act = isql_act('db', test_script)
|
||||
|
||||
expected_stdout = """
|
||||
UUID_TO_CHAR
|
||||
====================================
|
||||
93519227-8D50-4E47-81AA-8F6678C096A1
|
||||
@ -33,8 +26,8 @@ UUID_TO_CHAR
|
||||
"""
|
||||
|
||||
@pytest.mark.version('>=3.0')
|
||||
def test_1(act_1: Action):
|
||||
act_1.expected_stdout = expected_stdout_1
|
||||
act_1.execute()
|
||||
assert act_1.clean_stdout == act_1.clean_expected_stdout
|
||||
def test_1(act: Action):
|
||||
act.expected_stdout = expected_stdout
|
||||
act.execute()
|
||||
assert act.clean_stdout == act.clean_expected_stdout
|
||||
|
||||
|
@ -1,36 +1,28 @@
|
||||
#coding:utf-8
|
||||
#
|
||||
# id: bugs.core_1677
|
||||
# title: Floor & ceiling functions give wrong results with exact numeric arguments
|
||||
# decription: Floor & ceiling functions give wrong results with exact numeric arguments
|
||||
# select floor(cast(1500 as numeric(18,5))) from rdb$database -> -4827 (wrong)
|
||||
# select floor(cast(1500 as numeric(18,4))) from rdb$database -> 1500 (correct)
|
||||
# select ceiling(cast(1500 as numeric(18,5))) from rdb$database -> -4826 (wrong)
|
||||
#
|
||||
# Actually, any precision higher than 6 gives a wrong result.
|
||||
# tracker_id: CORE-1677
|
||||
# min_versions: []
|
||||
# versions: 2.1
|
||||
# qmid: bugs.core_1677
|
||||
|
||||
import pytest
|
||||
from firebird.qa import db_factory, isql_act, Action
|
||||
|
||||
# version: 2.1
|
||||
# resources: None
|
||||
|
||||
substitutions_1 = []
|
||||
|
||||
init_script_1 = """"""
|
||||
|
||||
db_1 = db_factory(sql_dialect=3, init=init_script_1)
|
||||
|
||||
test_script_1 = """select floor(cast(1500 as numeric(18,5))) F1,floor(cast(1500 as numeric(18,4))) F2, ceiling(cast(1500 as numeric(18,5))) F3 from rdb$database;
|
||||
"""
|
||||
ID: issue-2102
|
||||
ISSUE: 2102
|
||||
TITLE: Floor & ceiling functions give wrong results with exact numeric arguments
|
||||
DESCRIPTION:
|
||||
select floor(cast(1500 as numeric(18,5))) from rdb$database -> -4827 (wrong)
|
||||
select floor(cast(1500 as numeric(18,4))) from rdb$database -> 1500 (correct)
|
||||
select ceiling(cast(1500 as numeric(18,5))) from rdb$database -> -4826 (wrong)
|
||||
Actually, any precision higher than 6 gives a wrong result.
|
||||
JIRA: CORE-1677
|
||||
"""
|
||||
|
||||
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
|
||||
import pytest
|
||||
from firebird.qa import *
|
||||
|
||||
expected_stdout_1 = """
|
||||
db = db_factory()
|
||||
|
||||
test_script = """select floor(cast(1500 as numeric(18,5))) F1,floor(cast(1500 as numeric(18,4))) F2, ceiling(cast(1500 as numeric(18,5))) F3 from rdb$database;
|
||||
"""
|
||||
|
||||
act = isql_act('db', test_script)
|
||||
|
||||
expected_stdout = """
|
||||
F1 F2 F3
|
||||
===================== ===================== =====================
|
||||
1500 1500 1500
|
||||
@ -38,8 +30,8 @@ expected_stdout_1 = """
|
||||
"""
|
||||
|
||||
@pytest.mark.version('>=2.1')
|
||||
def test_1(act_1: Action):
|
||||
act_1.expected_stdout = expected_stdout_1
|
||||
act_1.execute()
|
||||
assert act_1.clean_stdout == act_1.clean_expected_stdout
|
||||
def test_1(act: Action):
|
||||
act.expected_stdout = expected_stdout
|
||||
act.execute()
|
||||
assert act.clean_stdout == act.clean_expected_stdout
|
||||
|
||||
|
@ -1,38 +1,17 @@
|
||||
#coding:utf-8
|
||||
#
|
||||
# id: bugs.core_1689
|
||||
# title: 'There are <n> dependencies' error message shows the wrong count of dependent objects.
|
||||
# decription:
|
||||
# For FB 2.5 and 3.x - this test uses UDF from ib_udf.
|
||||
#
|
||||
# 24.01.2019.
|
||||
# Added separate code for running on FB 3.0.x because its current STDERR now differ from old one.
|
||||
#
|
||||
# Added separate code for running on FB 4.0.x.
|
||||
# UDF usage is deprecated in FB 4+, see: ".../doc/README.incompatibilities.3to4.txt".
|
||||
# Functions div, frac, dow, sdow, getExactTimestampUTC and isLeapYear got safe replacement
|
||||
# in UDR library "udf_compat", see it in folder: ../plugins/udr/
|
||||
#
|
||||
# Checked on:
|
||||
# 2.5.9.27126: OK, 0.719s.
|
||||
# 3.0.5.33086: OK, 1.734s.
|
||||
# 4.0.0.1340: OK, 3.078s.
|
||||
# 4.0.0.1378: OK, 3.234s.
|
||||
#
|
||||
# NOTE. Build 4.0.0.1172 (date: 25.08.2018) raises here exception with 'UDF' instead 'Function' in STDERR.
|
||||
#
|
||||
# tracker_id: CORE-1689
|
||||
# min_versions: ['2.5.0']
|
||||
# versions: 3.0, 4.0
|
||||
# qmid: None
|
||||
|
||||
"""
|
||||
ID: issue-2115
|
||||
ISSUE: 2115
|
||||
TITLE: 'There are <n> dependencies' error message shows the wrong count of dependent objects.
|
||||
DESCRIPTION:
|
||||
JIRA: CORE-1689
|
||||
"""
|
||||
|
||||
import pytest
|
||||
from firebird.qa import db_factory, isql_act, Action
|
||||
from firebird.qa import *
|
||||
|
||||
# version: 3.0
|
||||
# resources: None
|
||||
|
||||
substitutions_1 = []
|
||||
|
||||
init_script_1 = """
|
||||
set term ^;
|
||||
@ -48,13 +27,13 @@ init_script_1 = """
|
||||
create domain dud int check(value between extract(week from UDF30_getExactTimestamp()) and 25)^
|
||||
"""
|
||||
|
||||
db_1 = db_factory(sql_dialect=3, init=init_script_1)
|
||||
db_1 = db_factory(init=init_script_1)
|
||||
|
||||
test_script_1 = """
|
||||
drop external function UDF30_getExactTimestamp;
|
||||
"""
|
||||
|
||||
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
|
||||
act_1 = isql_act('db_1', test_script_1)
|
||||
|
||||
expected_stderr_1 = """
|
||||
Statement failed, SQLSTATE = 38000
|
||||
@ -71,13 +50,8 @@ def test_1(act_1: Action):
|
||||
assert act_1.clean_stderr == act_1.clean_expected_stderr
|
||||
|
||||
# version: 4.0
|
||||
# resources: None
|
||||
|
||||
substitutions_2 = []
|
||||
|
||||
init_script_2 = """"""
|
||||
|
||||
db_2 = db_factory(sql_dialect=3, init=init_script_2)
|
||||
db_2 = db_factory()
|
||||
|
||||
test_script_2 = """
|
||||
-- See declaration sample in plugins\\udr\\UdfBackwardCompatibility.sql:
|
||||
@ -86,36 +60,36 @@ test_script_2 = """
|
||||
returns timestamp
|
||||
external name 'udf_compat!UC_getExactTimestampUTC'
|
||||
engine udr;
|
||||
|
||||
|
||||
create table test_dts(
|
||||
id int,
|
||||
dts timestamp check ( datediff(minute from dts to UDR40_getExactTimestampUTC()) < 5 )
|
||||
id int,
|
||||
dts timestamp check ( datediff(minute from dts to UDR40_getExactTimestampUTC()) < 5 )
|
||||
);
|
||||
commit;
|
||||
|
||||
|
||||
set term ^;
|
||||
create trigger trg_test_dts_ad for test_dts after delete as
|
||||
declare dummy timestamp;
|
||||
begin
|
||||
dummy = UDR40_getExactTimestampUTC();
|
||||
declare dummy timestamp;
|
||||
begin
|
||||
dummy = UDR40_getExactTimestampUTC();
|
||||
end
|
||||
^
|
||||
set term ;^
|
||||
commit;
|
||||
|
||||
|
||||
|
||||
create view v_test as
|
||||
|
||||
|
||||
create view v_test as
|
||||
select UDR40_getExactTimestampUTC() as UTC_stamp -- rdb$N, dep_type=3
|
||||
from rdb$database
|
||||
;
|
||||
|
||||
|
||||
|
||||
|
||||
create table test_udr(a int, c computed by( UDR40_getExactTimestampUTC() )) -- rdb$N, dep_type=3
|
||||
;
|
||||
|
||||
|
||||
create domain dm_test int check(value between extract(week from UDR40_getExactTimestampUTC() ) and 25) ;
|
||||
|
||||
|
||||
commit;
|
||||
|
||||
drop function UDR40_getExactTimestampUTC;
|
||||
@ -131,7 +105,7 @@ test_script_2 = """
|
||||
*/
|
||||
"""
|
||||
|
||||
act_2 = isql_act('db_2', test_script_2, substitutions=substitutions_2)
|
||||
act_2 = isql_act('db_2', test_script_2)
|
||||
|
||||
expected_stderr_2 = """
|
||||
Statement failed, SQLSTATE = 38000
|
||||
|
@ -1,39 +1,34 @@
|
||||
#coding:utf-8
|
||||
#
|
||||
# id: bugs.core_1690
|
||||
# title: arithmetic exception, numeric overflow, or string truncation in utf8 tables
|
||||
# decription:
|
||||
# tracker_id: CORE-1690
|
||||
# min_versions: []
|
||||
# versions: 2.1.3
|
||||
# qmid: None
|
||||
|
||||
"""
|
||||
ID: issue-2116
|
||||
ISSUE: 2116
|
||||
TITLE: Arithmetic exception, numeric overflow, or string truncation in utf8 tables
|
||||
DESCRIPTION:
|
||||
JIRA: CORE-1690
|
||||
"""
|
||||
|
||||
import pytest
|
||||
from firebird.qa import db_factory, isql_act, Action
|
||||
from firebird.qa import *
|
||||
|
||||
# version: 2.1.3
|
||||
# resources: None
|
||||
|
||||
substitutions_1 = []
|
||||
|
||||
init_script_1 = """create table A (C1 INTEGER PRIMARY KEY);
|
||||
init_script = """create table A (C1 INTEGER PRIMARY KEY);
|
||||
"""
|
||||
|
||||
db_1 = db_factory(page_size=4096, charset='UTF8', sql_dialect=3, init=init_script_1)
|
||||
db = db_factory(charset='UTF8', init=init_script)
|
||||
|
||||
test_script_1 = """show table A;
|
||||
test_script = """show table A;
|
||||
"""
|
||||
|
||||
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
|
||||
act = isql_act('db', test_script)
|
||||
|
||||
expected_stdout_1 = """C1 INTEGER Not Null
|
||||
expected_stdout = """C1 INTEGER Not Null
|
||||
CONSTRAINT INTEG_2:
|
||||
Primary key (C1)
|
||||
"""
|
||||
|
||||
@pytest.mark.version('>=2.1.3')
|
||||
def test_1(act_1: Action):
|
||||
act_1.expected_stdout = expected_stdout_1
|
||||
act_1.execute()
|
||||
assert act_1.clean_stdout == act_1.clean_expected_stdout
|
||||
@pytest.mark.version('>=3')
|
||||
def test_1(act: Action):
|
||||
act.expected_stdout = expected_stdout
|
||||
act.execute()
|
||||
assert act.clean_stdout == act.clean_expected_stdout
|
||||
|
||||
|
@ -1,22 +1,17 @@
|
||||
#coding:utf-8
|
||||
#
|
||||
# id: bugs.core_1693
|
||||
# title: Error in EXECUTE STATEMENT inside CONNECT / TRANSACTION START triggers
|
||||
# decription:
|
||||
# tracker_id: CORE-1693
|
||||
# min_versions: []
|
||||
# versions: 2.5.0
|
||||
# qmid: None
|
||||
|
||||
"""
|
||||
ID: issue-2118
|
||||
ISSUE: 2118
|
||||
TITLE: Error in EXECUTE STATEMENT inside CONNECT / TRANSACTION START triggers
|
||||
DESCRIPTION:
|
||||
JIRA: CORE-1693
|
||||
"""
|
||||
|
||||
import pytest
|
||||
from firebird.qa import db_factory, isql_act, Action
|
||||
from firebird.qa import *
|
||||
|
||||
# version: 2.5.0
|
||||
# resources: None
|
||||
|
||||
substitutions_1 = []
|
||||
|
||||
init_script_1 = """set term ^ ;
|
||||
init_script = """set term ^ ;
|
||||
|
||||
create trigger t_connect on connect
|
||||
as
|
||||
@ -28,23 +23,23 @@ end ^
|
||||
set term ; ^
|
||||
"""
|
||||
|
||||
db_1 = db_factory(page_size=4096, sql_dialect=3, init=init_script_1)
|
||||
db = db_factory(init=init_script)
|
||||
|
||||
test_script_1 = """select 1 from rdb$database;
|
||||
test_script = """select 1 from rdb$database;
|
||||
"""
|
||||
|
||||
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
|
||||
act = isql_act('db', test_script)
|
||||
|
||||
expected_stdout_1 = """
|
||||
expected_stdout = """
|
||||
CONSTANT
|
||||
============
|
||||
1
|
||||
|
||||
"""
|
||||
|
||||
@pytest.mark.version('>=2.5.0')
|
||||
def test_1(act_1: Action):
|
||||
act_1.expected_stdout = expected_stdout_1
|
||||
act_1.execute()
|
||||
assert act_1.clean_stdout == act_1.clean_expected_stdout
|
||||
@pytest.mark.version('>=3')
|
||||
def test_1(act: Action):
|
||||
act.expected_stdout = expected_stdout
|
||||
act.execute()
|
||||
assert act.clean_stdout == act.clean_expected_stdout
|
||||
|
||||
|
@ -1,85 +1,78 @@
|
||||
#coding:utf-8
|
||||
#
|
||||
# id: bugs.core_1694
|
||||
# title: Bug in create/alter Database trigger (with Russian comment)
|
||||
# decription:
|
||||
# tracker_id: CORE-1694
|
||||
# min_versions: ['2.5.0']
|
||||
# versions: 2.5
|
||||
# qmid: None
|
||||
|
||||
"""
|
||||
ID: issue-2119
|
||||
ISSUE: 2119
|
||||
TITLE: Bug in create/alter Database trigger (with Russian comment)
|
||||
DESCRIPTION:
|
||||
JIRA: CORE-1694
|
||||
"""
|
||||
|
||||
import pytest
|
||||
from firebird.qa import db_factory, isql_act, Action
|
||||
from firebird.qa import *
|
||||
|
||||
# version: 2.5
|
||||
# resources: None
|
||||
db = db_factory(charset='UTF8')
|
||||
|
||||
substitutions_1 = [('[+++].*', ''), ('[===].*', ''), ('Trigger text.*', '')]
|
||||
|
||||
init_script_1 = """"""
|
||||
|
||||
db_1 = db_factory(page_size=4096, charset='UTF8', sql_dialect=3, init=init_script_1)
|
||||
|
||||
test_script_1 = """
|
||||
test_script = """
|
||||
create domain varchar_domain as varchar(50) character set utf8 collate utf8;
|
||||
create domain varchar_domain2 as varchar(50) character set utf8 collate utf8;
|
||||
create domain varchar_domain2 as varchar(50) character set utf8 collate utf8;
|
||||
commit;
|
||||
|
||||
|
||||
set term ^;
|
||||
execute block as
|
||||
begin
|
||||
execute statement '
|
||||
create or alter trigger trg_conn active on connect position 0
|
||||
as
|
||||
/*
|
||||
— Eh bien, mon prince. Gênes et Lucques ne sont plus que des apanages, des поместья,
|
||||
de la famille Buonaparte. Non, je vous préviens que si vous ne me dites pas que nous
|
||||
avons la guerre, si vous vous permettez encore de pallier toutes les infamies, toutes
|
||||
les atrocités de cet Antichrist (ma parole, j''y crois) — je ne vous connais plus, vous
|
||||
n''êtes plus mon ami, vous n''êtes plus мой верный раб, comme vous dites.
|
||||
/*
|
||||
— Eh bien, mon prince. Gênes et Lucques ne sont plus que des apanages, des поместья,
|
||||
de la famille Buonaparte. Non, je vous préviens que si vous ne me dites pas que nous
|
||||
avons la guerre, si vous vous permettez encore de pallier toutes les infamies, toutes
|
||||
les atrocités de cet Antichrist (ma parole, j''y crois) — je ne vous connais plus, vous
|
||||
n''êtes plus mon ami, vous n''êtes plus мой верный раб, comme vous dites.
|
||||
Ну, здравствуйте, здравствуйте. Je vois que je vous fais peur, садитесь и рассказывайте.
|
||||
Так говорила в июле 1805 года известная Анна Павловна Шерер, фрейлина и приближенная
|
||||
императрицы Марии Феодоровны, встречая важного и чиновного князя Василия, первого
|
||||
приехавшего на ее вечер. Анна Павловна кашляла несколько дней, у нее был грипп, как она
|
||||
говорила (грипп был тогда новое слово, употреблявшееся только редкими).
|
||||
Так говорила в июле 1805 года известная Анна Павловна Шерер, фрейлина и приближенная
|
||||
императрицы Марии Феодоровны, встречая важного и чиновного князя Василия, первого
|
||||
приехавшего на ее вечер. Анна Павловна кашляла несколько дней, у нее был грипп, как она
|
||||
говорила (грипп был тогда новое слово, употреблявшееся только редкими).
|
||||
*/
|
||||
declare u int;
|
||||
declare variable new_var1 varchar(50) character set utf8 collate utf8 default ''Que voulez-vous ?'';
|
||||
declare variable new_var3 type of varchar_domain default ''Что делать ?'';
|
||||
declare variable new_var4 type of varchar_domain2 default ''Кто виноват ?'';
|
||||
/*
|
||||
Dieu, quelle virulente sortie! 4 — отвечал, нисколько не смутясь такою встречей, вошедший
|
||||
князь, в придворном, шитом мундире, в чулках, башмаках и звездах, с светлым выражением
|
||||
плоского лица. Он говорил на том изысканном французском языке, на котором не только говорили,
|
||||
Dieu, quelle virulente sortie! 4 — отвечал, нисколько не смутясь такою встречей, вошедший
|
||||
князь, в придворном, шитом мундире, в чулках, башмаках и звездах, с светлым выражением
|
||||
плоского лица. Он говорил на том изысканном французском языке, на котором не только говорили,
|
||||
но и думали наши деды, и с теми, тихими, покровительственными интонациями, которые свойственны
|
||||
состаревшемуся в свете и при дворе значительному человеку. Он подошел к Анне Павловне,
|
||||
состаревшемуся в свете и при дворе значительному человеку. Он подошел к Анне Павловне,
|
||||
поцеловал ее руку, подставив ей свою надушенную и сияющую лысину, и покойно уселся на диване.
|
||||
*/
|
||||
*/
|
||||
declare v int = 2;
|
||||
/*
|
||||
— Ne me tourmentez pas. Eh bien, qu''a-t-on décidé par rapport à la dépêche de Novosilzoff?
|
||||
— Ne me tourmentez pas. Eh bien, qu''a-t-on décidé par rapport à la dépêche de Novosilzoff?
|
||||
Vous savez tout.
|
||||
— Как вам сказать? — сказал князь холодным, скучающим тоном. — Qu''a-t-on décidé? On a décidé
|
||||
— Как вам сказать? — сказал князь холодным, скучающим тоном. — Qu''a-t-on décidé? On a décidé
|
||||
que Buonaparte a brûlé ses vaisseaux, et je crois que nous sommes en train de brûler les nôtres 8.
|
||||
Князь Василий говорил всегда лениво, как актер говорит роль старой пиесы. Анна Павловна Шерер,
|
||||
напротив, несмотря на свои сорок лет, была преисполнена оживления и порывов.
|
||||
Князь Василий говорил всегда лениво, как актер говорит роль старой пиесы. Анна Павловна Шерер,
|
||||
напротив, несмотря на свои сорок лет, была преисполнена оживления и порывов.
|
||||
*/
|
||||
declare w int = 3;
|
||||
begin
|
||||
u =
|
||||
/*
|
||||
Ах, не говорите мне про Австрию! Я ничего не понимаю, может быть, но Австрия никогда не хотела
|
||||
и не хочет войны. Она предает нас. Россия одна должна быть спасительницей Европы. Наш благодетель
|
||||
знает свое высокое призвание и будет верен ему. Вот одно, во что я верю. Нашему доброму и чудному
|
||||
u =
|
||||
/*
|
||||
Ах, не говорите мне про Австрию! Я ничего не понимаю, может быть, но Австрия никогда не хотела
|
||||
и не хочет войны. Она предает нас. Россия одна должна быть спасительницей Европы. Наш благодетель
|
||||
знает свое высокое призвание и будет верен ему. Вот одно, во что я верю. Нашему доброму и чудному
|
||||
*/
|
||||
v +
|
||||
/*государю предстоит величайшая роль в мире, и он так добродетелен и хорош, что Бог не оставит его,
|
||||
и он исполнит свое призвание задавить гидру революции, которая теперь еще ужаснее в лице этого
|
||||
убийцы и злодея. Мы одни должны искупить кровь праведника. На кого нам надеяться, я вас спрашиваю?..
|
||||
/*государю предстоит величайшая роль в мире, и он так добродетелен и хорош, что Бог не оставит его,
|
||||
и он исполнит свое призвание задавить гидру революции, которая теперь еще ужаснее в лице этого
|
||||
убийцы и злодея. Мы одни должны искупить кровь праведника. На кого нам надеяться, я вас спрашиваю?..
|
||||
*/
|
||||
w;
|
||||
/*
|
||||
Англия с своим коммерческим духом не поймет и не может понять всю высоту души императора Александра
|
||||
Англия с своим коммерческим духом не поймет и не может понять всю высоту души императора Александра
|
||||
*/
|
||||
end'
|
||||
;
|
||||
@ -91,68 +84,69 @@ commit;
|
||||
show trigger trg_conn;
|
||||
"""
|
||||
|
||||
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
|
||||
act = isql_act('db', test_script,
|
||||
substitutions=[('[+++].*', ''), ('[===].*', ''), ('Trigger text.*', '')])
|
||||
|
||||
expected_stdout_1 = """
|
||||
expected_stdout = """
|
||||
TRG_CONN, Sequence: 0, Type: ON CONNECT, Active
|
||||
as
|
||||
/*
|
||||
— Eh bien, mon prince. Gênes et Lucques ne sont plus que des apanages, des поместья,
|
||||
de la famille Buonaparte. Non, je vous préviens que si vous ne me dites pas que nous
|
||||
avons la guerre, si vous vous permettez encore de pallier toutes les infamies, toutes
|
||||
les atrocités de cet Antichrist (ma parole, j'y crois) — je ne vous connais plus, vous
|
||||
n'êtes plus mon ami, vous n'êtes plus мой верный раб, comme vous dites.
|
||||
/*
|
||||
— Eh bien, mon prince. Gênes et Lucques ne sont plus que des apanages, des поместья,
|
||||
de la famille Buonaparte. Non, je vous préviens que si vous ne me dites pas que nous
|
||||
avons la guerre, si vous vous permettez encore de pallier toutes les infamies, toutes
|
||||
les atrocités de cet Antichrist (ma parole, j'y crois) — je ne vous connais plus, vous
|
||||
n'êtes plus mon ami, vous n'êtes plus мой верный раб, comme vous dites.
|
||||
Ну, здравствуйте, здравствуйте. Je vois que je vous fais peur, садитесь и рассказывайте.
|
||||
Так говорила в июле 1805 года известная Анна Павловна Шерер, фрейлина и приближенная
|
||||
императрицы Марии Феодоровны, встречая важного и чиновного князя Василия, первого
|
||||
приехавшего на ее вечер. Анна Павловна кашляла несколько дней, у нее был грипп, как она
|
||||
говорила (грипп был тогда новое слово, употреблявшееся только редкими).
|
||||
Так говорила в июле 1805 года известная Анна Павловна Шерер, фрейлина и приближенная
|
||||
императрицы Марии Феодоровны, встречая важного и чиновного князя Василия, первого
|
||||
приехавшего на ее вечер. Анна Павловна кашляла несколько дней, у нее был грипп, как она
|
||||
говорила (грипп был тогда новое слово, употреблявшееся только редкими).
|
||||
*/
|
||||
declare u int;
|
||||
declare variable new_var1 varchar(50) character set utf8 collate utf8 default 'Que voulez-vous ?';
|
||||
declare variable new_var3 type of varchar_domain default 'Что делать ?';
|
||||
declare variable new_var4 type of varchar_domain2 default 'Кто виноват ?';
|
||||
/*
|
||||
Dieu, quelle virulente sortie! 4 — отвечал, нисколько не смутясь такою встречей, вошедший
|
||||
князь, в придворном, шитом мундире, в чулках, башмаках и звездах, с светлым выражением
|
||||
плоского лица. Он говорил на том изысканном французском языке, на котором не только говорили,
|
||||
Dieu, quelle virulente sortie! 4 — отвечал, нисколько не смутясь такою встречей, вошедший
|
||||
князь, в придворном, шитом мундире, в чулках, башмаках и звездах, с светлым выражением
|
||||
плоского лица. Он говорил на том изысканном французском языке, на котором не только говорили,
|
||||
но и думали наши деды, и с теми, тихими, покровительственными интонациями, которые свойственны
|
||||
состаревшемуся в свете и при дворе значительному человеку. Он подошел к Анне Павловне,
|
||||
состаревшемуся в свете и при дворе значительному человеку. Он подошел к Анне Павловне,
|
||||
поцеловал ее руку, подставив ей свою надушенную и сияющую лысину, и покойно уселся на диване.
|
||||
*/
|
||||
*/
|
||||
declare v int = 2;
|
||||
/*
|
||||
— Ne me tourmentez pas. Eh bien, qu'a-t-on décidé par rapport à la dépêche de Novosilzoff?
|
||||
— Ne me tourmentez pas. Eh bien, qu'a-t-on décidé par rapport à la dépêche de Novosilzoff?
|
||||
Vous savez tout.
|
||||
— Как вам сказать? — сказал князь холодным, скучающим тоном. — Qu'a-t-on décidé? On a décidé
|
||||
— Как вам сказать? — сказал князь холодным, скучающим тоном. — Qu'a-t-on décidé? On a décidé
|
||||
que Buonaparte a brûlé ses vaisseaux, et je crois que nous sommes en train de brûler les nôtres 8.
|
||||
Князь Василий говорил всегда лениво, как актер говорит роль старой пиесы. Анна Павловна Шерер,
|
||||
напротив, несмотря на свои сорок лет, была преисполнена оживления и порывов.
|
||||
Князь Василий говорил всегда лениво, как актер говорит роль старой пиесы. Анна Павловна Шерер,
|
||||
напротив, несмотря на свои сорок лет, была преисполнена оживления и порывов.
|
||||
*/
|
||||
declare w int = 3;
|
||||
begin
|
||||
u =
|
||||
/*
|
||||
Ах, не говорите мне про Австрию! Я ничего не понимаю, может быть, но Австрия никогда не хотела
|
||||
и не хочет войны. Она предает нас. Россия одна должна быть спасительницей Европы. Наш благодетель
|
||||
знает свое высокое призвание и будет верен ему. Вот одно, во что я верю. Нашему доброму и чудному
|
||||
u =
|
||||
/*
|
||||
Ах, не говорите мне про Австрию! Я ничего не понимаю, может быть, но Австрия никогда не хотела
|
||||
и не хочет войны. Она предает нас. Россия одна должна быть спасительницей Европы. Наш благодетель
|
||||
знает свое высокое призвание и будет верен ему. Вот одно, во что я верю. Нашему доброму и чудному
|
||||
*/
|
||||
v +
|
||||
/*государю предстоит величайшая роль в мире, и он так добродетелен и хорош, что Бог не оставит его,
|
||||
и он исполнит свое призвание задавить гидру революции, которая теперь еще ужаснее в лице этого
|
||||
убийцы и злодея. Мы одни должны искупить кровь праведника. На кого нам надеяться, я вас спрашиваю?..
|
||||
/*государю предстоит величайшая роль в мире, и он так добродетелен и хорош, что Бог не оставит его,
|
||||
и он исполнит свое призвание задавить гидру революции, которая теперь еще ужаснее в лице этого
|
||||
убийцы и злодея. Мы одни должны искупить кровь праведника. На кого нам надеяться, я вас спрашиваю?..
|
||||
*/
|
||||
w;
|
||||
/*
|
||||
Англия с своим коммерческим духом не поймет и не может понять всю высоту души императора Александра
|
||||
Англия с своим коммерческим духом не поймет и не может понять всю высоту души императора Александра
|
||||
*/
|
||||
end
|
||||
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
"""
|
||||
|
||||
@pytest.mark.version('>=2.5')
|
||||
def test_1(act_1: Action):
|
||||
act_1.expected_stdout = expected_stdout_1
|
||||
act_1.execute()
|
||||
assert act_1.clean_stdout == act_1.clean_expected_stdout
|
||||
@pytest.mark.version('>=3')
|
||||
def test_1(act: Action):
|
||||
act.expected_stdout = expected_stdout
|
||||
act.execute()
|
||||
assert act.clean_stdout == act.clean_expected_stdout
|
||||
|
||||
|
@ -1,53 +1,42 @@
|
||||
#coding:utf-8
|
||||
#
|
||||
# id: bugs.core_1712
|
||||
# title: Buffer overflow in conversion
|
||||
# decription:
|
||||
# Confirmed bug on WI-V2.0.0.12724:
|
||||
# * "buffer overrun" when use dialect 1;
|
||||
# * "string right truncation" when use dialect 3.
|
||||
# Checked on:
|
||||
# Windows: 3.0.8.33445, 4.0.0.2416
|
||||
# Linux: 3.0.8.33426, 4.0.0.2416
|
||||
#
|
||||
# tracker_id: CORE-1712
|
||||
# min_versions: ['2.5.0']
|
||||
# versions: 2.5
|
||||
# qmid: None
|
||||
|
||||
"""
|
||||
ID: issue-2137
|
||||
ISSUE: 2137
|
||||
TITLE: Buffer overflow in conversion
|
||||
DESCRIPTION:
|
||||
Confirmed bug on WI-V2.0.0.12724:
|
||||
* "buffer overrun" when use dialect 1;
|
||||
* "string right truncation" when use dialect 3.
|
||||
JIRA: CORE-1712
|
||||
"""
|
||||
|
||||
import pytest
|
||||
from firebird.qa import db_factory, isql_act, Action
|
||||
from firebird.qa import *
|
||||
|
||||
# version: 2.5
|
||||
# resources: None
|
||||
db = db_factory(sql_dialect=1)
|
||||
|
||||
substitutions_1 = []
|
||||
|
||||
init_script_1 = """"""
|
||||
|
||||
db_1 = db_factory(sql_dialect=1, init=init_script_1)
|
||||
|
||||
test_script_1 = """
|
||||
test_script = """
|
||||
recreate table testtable(f1 numeric(15, 2));
|
||||
commit;
|
||||
|
||||
|
||||
insert into testtable(f1) values(1e19);
|
||||
commit;
|
||||
|
||||
|
||||
set list on;
|
||||
select replace(cast(f1 as varchar(30)),'0','') f1_as_varchar30 from testtable;
|
||||
commit;
|
||||
"""
|
||||
|
||||
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
|
||||
act = isql_act('db', test_script)
|
||||
|
||||
expected_stdout_1 = """
|
||||
expected_stdout = """
|
||||
F1_AS_VARCHAR30 1.e+19
|
||||
"""
|
||||
|
||||
@pytest.mark.version('>=2.5')
|
||||
def test_1(act_1: Action):
|
||||
act_1.expected_stdout = expected_stdout_1
|
||||
act_1.execute()
|
||||
assert act_1.clean_stdout == act_1.clean_expected_stdout
|
||||
@pytest.mark.version('>=3')
|
||||
def test_1(act: Action):
|
||||
act.expected_stdout = expected_stdout
|
||||
act.execute()
|
||||
assert act.clean_stdout == act.clean_expected_stdout
|
||||
|
||||
|
@ -1,46 +1,41 @@
|
||||
#coding:utf-8
|
||||
#
|
||||
# id: bugs.core_1715
|
||||
# title: Incorrect "key size exceeds implementation restriction for index" error
|
||||
# decription:
|
||||
# tracker_id: CORE-1715
|
||||
# min_versions: []
|
||||
# versions: 2.1.0
|
||||
# qmid: bugs.core_1715
|
||||
|
||||
"""
|
||||
ID: issue-2140
|
||||
ISSUE: 2140
|
||||
TITLE: Incorrect "key size exceeds implementation restriction for index" error
|
||||
DESCRIPTION:
|
||||
JIRA: CORE-1715
|
||||
"""
|
||||
|
||||
import pytest
|
||||
from firebird.qa import db_factory, isql_act, Action
|
||||
from firebird.qa import *
|
||||
|
||||
# version: 2.1.0
|
||||
# resources: None
|
||||
|
||||
substitutions_1 = []
|
||||
|
||||
init_script_1 = """create table t1 (
|
||||
init_script = """create table t1 (
|
||||
t1_id integer not null
|
||||
, vc_50_utf8_utf8 varchar(253) character set utf8 collate utf8
|
||||
, vc_50_utf8_unicode varchar(169) character set utf8 collate unicode
|
||||
, constraint pk_t1_id primary key (t1_id)
|
||||
);"""
|
||||
|
||||
db_1 = db_factory(page_size=4096, charset='UTF8', sql_dialect=3, init=init_script_1)
|
||||
db = db_factory(charset='UTF8', init=init_script)
|
||||
|
||||
test_script_1 = """create index i_vc_50_utf8_unicode on t1 (vc_50_utf8_unicode);
|
||||
test_script = """create index i_vc_50_utf8_unicode on t1 (vc_50_utf8_unicode);
|
||||
create index i_vc_50_utf8_utf8 on t1 (vc_50_utf8_utf8);
|
||||
commit;
|
||||
show index;
|
||||
"""
|
||||
|
||||
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
|
||||
act = isql_act('db', test_script)
|
||||
|
||||
expected_stdout_1 = """I_VC_50_UTF8_UNICODE INDEX ON T1(VC_50_UTF8_UNICODE)
|
||||
expected_stdout = """I_VC_50_UTF8_UNICODE INDEX ON T1(VC_50_UTF8_UNICODE)
|
||||
I_VC_50_UTF8_UTF8 INDEX ON T1(VC_50_UTF8_UTF8)
|
||||
PK_T1_ID UNIQUE INDEX ON T1(T1_ID)
|
||||
"""
|
||||
|
||||
@pytest.mark.version('>=2.1.0')
|
||||
def test_1(act_1: Action):
|
||||
act_1.expected_stdout = expected_stdout_1
|
||||
act_1.execute()
|
||||
assert act_1.clean_stdout == act_1.clean_expected_stdout
|
||||
@pytest.mark.version('>=3')
|
||||
def test_1(act: Action):
|
||||
act.expected_stdout = expected_stdout
|
||||
act.execute()
|
||||
assert act.clean_stdout == act.clean_expected_stdout
|
||||
|
||||
|
@ -1,26 +1,19 @@
|
||||
#coding:utf-8
|
||||
#
|
||||
# id: bugs.core_1716
|
||||
# title: Wrong variable initialization in recursive procedures
|
||||
# decription:
|
||||
# tracker_id: CORE-1716
|
||||
# min_versions: ['2.1.7']
|
||||
# versions: 2.1.7
|
||||
# qmid: None
|
||||
|
||||
"""
|
||||
ID: issue-2141
|
||||
ISSUE: 2141
|
||||
TITLE: Wrong variable initialization in recursive procedures
|
||||
DESCRIPTION:
|
||||
JIRA: CORE-1716
|
||||
"""
|
||||
|
||||
import pytest
|
||||
from firebird.qa import db_factory, isql_act, Action
|
||||
from firebird.qa import *
|
||||
|
||||
# version: 2.1.7
|
||||
# resources: None
|
||||
db = db_factory()
|
||||
|
||||
substitutions_1 = [('=.*', '')]
|
||||
|
||||
init_script_1 = """"""
|
||||
|
||||
db_1 = db_factory(page_size=4096, sql_dialect=3, init=init_script_1)
|
||||
|
||||
test_script_1 = """
|
||||
test_script = """
|
||||
create domain dm_int as integer default 0 not null;
|
||||
commit;
|
||||
|
||||
@ -74,9 +67,9 @@ test_script_1 = """
|
||||
select * from sp_test2(3);
|
||||
"""
|
||||
|
||||
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
|
||||
act = isql_act('db', test_script, substitutions=[('=.*', '')])
|
||||
|
||||
expected_stdout_1 = """
|
||||
expected_stdout = """
|
||||
O_CNT O_RET
|
||||
============ ============
|
||||
3 0
|
||||
@ -101,9 +94,9 @@ expected_stdout_1 = """
|
||||
1 0
|
||||
"""
|
||||
|
||||
@pytest.mark.version('>=2.1.7')
|
||||
def test_1(act_1: Action):
|
||||
act_1.expected_stdout = expected_stdout_1
|
||||
act_1.execute()
|
||||
assert act_1.clean_stdout == act_1.clean_expected_stdout
|
||||
@pytest.mark.version('>=3')
|
||||
def test_1(act: Action):
|
||||
act.expected_stdout = expected_stdout
|
||||
act.execute()
|
||||
assert act.clean_stdout == act.clean_expected_stdout
|
||||
|
||||
|
@ -1,26 +1,19 @@
|
||||
#coding:utf-8
|
||||
#
|
||||
# id: bugs.core_1724
|
||||
# title: Common table expressions cannot be used in computed columns and quantified predicates (IN / ANY / ALL)
|
||||
# decription:
|
||||
# tracker_id: CORE-1724
|
||||
# min_versions: ['2.5.0']
|
||||
# versions: 2.5
|
||||
# qmid: None
|
||||
|
||||
"""
|
||||
ID: issue-2148
|
||||
ISSUE: 2148
|
||||
TITLE: Common table expressions cannot be used in computed columns and quantified predicates (IN / ANY / ALL)
|
||||
DESCRIPTION:
|
||||
JIRA: CORE-1724
|
||||
"""
|
||||
|
||||
import pytest
|
||||
from firebird.qa import db_factory, isql_act, Action
|
||||
from firebird.qa import *
|
||||
|
||||
# version: 2.5
|
||||
# resources: None
|
||||
db = db_factory()
|
||||
|
||||
substitutions_1 = []
|
||||
|
||||
init_script_1 = """"""
|
||||
|
||||
db_1 = db_factory(page_size=4096, sql_dialect=3, init=init_script_1)
|
||||
|
||||
test_script_1 = """
|
||||
test_script = """
|
||||
set list on;
|
||||
select
|
||||
sign( count(*) ) +
|
||||
@ -62,15 +55,15 @@ test_script_1 = """
|
||||
);
|
||||
"""
|
||||
|
||||
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
|
||||
act = isql_act('db', test_script)
|
||||
|
||||
expected_stdout_1 = """
|
||||
expected_stdout = """
|
||||
S 6
|
||||
"""
|
||||
|
||||
@pytest.mark.version('>=2.5')
|
||||
def test_1(act_1: Action):
|
||||
act_1.expected_stdout = expected_stdout_1
|
||||
act_1.execute()
|
||||
assert act_1.clean_stdout == act_1.clean_expected_stdout
|
||||
@pytest.mark.version('>=3')
|
||||
def test_1(act: Action):
|
||||
act.expected_stdout = expected_stdout
|
||||
act.execute()
|
||||
assert act.clean_stdout == act.clean_expected_stdout
|
||||
|
||||
|
@ -1,49 +1,22 @@
|
||||
#coding:utf-8
|
||||
#
|
||||
# id: bugs.core_1725
|
||||
# title: Unable to restore a database with inactive indices if any SP/trigger contains an explicit plan
|
||||
# decription:
|
||||
# We create database and add a table with two indices there.
|
||||
# Then we create several program objects that use these indices explicitly by specifying 'PLAN' clause:
|
||||
# view, standalone procedure, standalone function, packaged procedure and function and DB-level trigger.
|
||||
# We also create several units that do not use these index explicitly.
|
||||
# Then we extract metadata from this DB ans saved in "initial" .sql, see 'f_meta_init' var.
|
||||
#
|
||||
# After this, we do backup and restore (using PIPE mechanism in order to avoid creation of unneeded .fbk).
|
||||
# Restored database is further renamed to initial name and we do on this DB:
|
||||
# * full validation and
|
||||
# * metadata extraction, see 'f_meta_rest' var.
|
||||
#
|
||||
# Result of validation must be "0 errors and 0 warnings".
|
||||
# Result of extracted metadata comparison must be empty (no difference). ALL program objects must be preserved.
|
||||
#
|
||||
# Checked on:
|
||||
# 4.0.0.1881 SS: 6.238s.
|
||||
# 4.0.0.1391 SC: 12.503s.
|
||||
# 3.0.6.33283 SS: 3.859s.
|
||||
# 3.0.6.33276 SS: 4.002s.
|
||||
#
|
||||
# ::: NB ::: This bug was fixed between 17-dec-2018 and 23-jan-2019.
|
||||
# Builds 4.0.0.1346 and 3.0.5.33084 (both of 17.12.2018) still have bug: no program units will be in restored DB.
|
||||
# Builds 4.0.0.1391 (23.01.2019) and 3.0.5.33097 (01.02.2019) work fine.
|
||||
#
|
||||
# tracker_id: CORE-1725
|
||||
# min_versions: ['3.0.6']
|
||||
# versions: 3.0.6
|
||||
# qmid: None
|
||||
|
||||
"""
|
||||
ID: issue-2149
|
||||
ISSUE: 2149
|
||||
TITLE: Unable to restore a database with inactive indices if any SP/trigger contains an explicit plan
|
||||
DESCRIPTION:
|
||||
JIRA: CORE-1725
|
||||
"""
|
||||
|
||||
import pytest
|
||||
from firebird.qa import db_factory, python_act, Action
|
||||
from firebird.qa import *
|
||||
from firebird.driver import SrvRestoreFlag, SrvRepairFlag
|
||||
from io import BytesIO
|
||||
from difflib import unified_diff
|
||||
|
||||
# version: 3.0.6
|
||||
# resources: None
|
||||
|
||||
substitutions_1 = [('[ \t]+', ' ')]
|
||||
|
||||
init_script_1 = """
|
||||
init_script = """
|
||||
set bail on;
|
||||
|
||||
create or alter procedure sp_init as begin end;
|
||||
@ -203,383 +176,37 @@ set term ;^
|
||||
commit;
|
||||
"""
|
||||
|
||||
db_1 = db_factory(sql_dialect=3, init=init_script_1)
|
||||
db = db_factory(init=init_script)
|
||||
|
||||
# test_script_1
|
||||
#---
|
||||
#
|
||||
# import os
|
||||
# import time
|
||||
# import shutil
|
||||
# import difflib
|
||||
# import subprocess
|
||||
# from subprocess import Popen
|
||||
# from subprocess import PIPE
|
||||
# from fdb import services
|
||||
#
|
||||
# os.environ["ISC_USER"] = user_name
|
||||
# os.environ["ISC_PASSWORD"] = user_password
|
||||
# DB_PATH = os.sep.join( db_conn.database_name.split(os.sep)[:-1] )
|
||||
# db_conn.close()
|
||||
#
|
||||
# #--------------------------------------------
|
||||
#
|
||||
# def flush_and_close(file_handle):
|
||||
# # https://docs.python.org/2/library/os.html#os.fsync
|
||||
# # If you're starting with a Python file object f,
|
||||
# # first do f.flush(), and
|
||||
# # then do os.fsync(f.fileno()), to ensure that all internal buffers associated with f are written to disk.
|
||||
# global os
|
||||
#
|
||||
# file_handle.flush()
|
||||
# if file_handle.mode not in ('r', 'rb'):
|
||||
# # otherwise: "OSError: [Errno 9] Bad file descriptor"!
|
||||
# os.fsync(file_handle.fileno())
|
||||
# file_handle.close()
|
||||
#
|
||||
# #--------------------------------------------
|
||||
#
|
||||
# def cleanup( f_names_list ):
|
||||
# global os
|
||||
# for i in range(len( f_names_list )):
|
||||
# if os.path.isfile( f_names_list[i]):
|
||||
# os.remove( f_names_list[i] )
|
||||
#
|
||||
# #--------------------------------------------
|
||||
#
|
||||
# def svc_get_fb_log( f_fb_log ):
|
||||
#
|
||||
# global subprocess
|
||||
# subprocess.call( [ context['fbsvcmgr_path'],
|
||||
# "localhost:service_mgr",
|
||||
# "action_get_fb_log"
|
||||
# ],
|
||||
# stdout=f_fb_log, stderr=subprocess.STDOUT
|
||||
# )
|
||||
# return
|
||||
#
|
||||
# #--------------------------------------------
|
||||
#
|
||||
# tmp_initdb = os.path.join(context['temp_directory'],'tmp_1725_init.fdb')
|
||||
# tmp_restdb = os.path.join(context['temp_directory'],'tmp_1725_rest.fdb')
|
||||
#
|
||||
# cleanup( (tmp_initdb, tmp_restdb,) )
|
||||
#
|
||||
# sql_init='''
|
||||
# set bail on;
|
||||
#
|
||||
# create database 'localhost:%(tmp_initdb)s' user %(user_name)s password '%(user_password)s';
|
||||
#
|
||||
# create or alter procedure sp_init as begin end;
|
||||
# create or alter procedure sp_main as begin end;
|
||||
# create or alter procedure sp_worker as begin end;
|
||||
#
|
||||
# create or alter function fn_init returns int as begin end;
|
||||
# create or alter function fn_main returns int as begin end;
|
||||
# create or alter function fn_worker returns int as begin end;
|
||||
#
|
||||
#
|
||||
# create table test(id int primary key, x int, y int);
|
||||
# create index test_x on test(x);
|
||||
# create descending index test_y on test(y);
|
||||
# commit;
|
||||
#
|
||||
# insert into test(id, x, y) select row_number()over(), rand()*5, rand()*100 from rdb$types;
|
||||
# commit;
|
||||
#
|
||||
# create or alter view v_init as
|
||||
# select count(*) as cnt from test group by x
|
||||
# rows 1
|
||||
# ;
|
||||
#
|
||||
# create or alter view v_worker as
|
||||
# select count(*) as cnt
|
||||
# from test
|
||||
# group by y
|
||||
# plan (TEST ORDER TEST_Y)
|
||||
# union all
|
||||
# select cnt from v_init
|
||||
# ;
|
||||
# commit;
|
||||
#
|
||||
#
|
||||
# set term ^;
|
||||
# execute block as
|
||||
# begin
|
||||
# rdb$set_context('USER_SESSION','INITIAL_DDL', '1');
|
||||
# end
|
||||
# ^
|
||||
#
|
||||
# create or alter procedure sp_init as
|
||||
# declare c int;
|
||||
# begin
|
||||
# select count(*) from test group by x
|
||||
# rows 1
|
||||
# into c
|
||||
# ;
|
||||
# end
|
||||
# ^
|
||||
#
|
||||
# create or alter procedure sp_main as
|
||||
# begin
|
||||
# execute procedure sp_worker;
|
||||
# end
|
||||
# ^
|
||||
#
|
||||
# create or alter procedure sp_worker as
|
||||
# declare c int;
|
||||
# begin
|
||||
# select sum(cnt)
|
||||
# from (
|
||||
# select count(*) as cnt
|
||||
# from test group by x
|
||||
# plan (TEST ORDER TEST_X)
|
||||
# union all
|
||||
# select cnt from v_worker
|
||||
# )
|
||||
# into c
|
||||
# ;
|
||||
# end
|
||||
# ^
|
||||
# create or alter function fn_init returns int as
|
||||
# begin
|
||||
# return ( select count(*) from test );
|
||||
# end
|
||||
# ^
|
||||
# create or alter function fn_worker returns int as
|
||||
# begin
|
||||
# return (
|
||||
# select sum(cnt)
|
||||
# from (
|
||||
# select count(*) as cnt
|
||||
# from test group by x
|
||||
# plan (TEST ORDER TEST_X)
|
||||
# union all
|
||||
# select cnt from v_worker
|
||||
# )
|
||||
# );
|
||||
# end
|
||||
# ^
|
||||
# create or alter function fn_main returns int as
|
||||
# begin
|
||||
# return fn_worker();
|
||||
# end
|
||||
# ^
|
||||
#
|
||||
# create or alter package pg_test as
|
||||
# begin
|
||||
# function pg_fn_worker returns int;
|
||||
# procedure pg_sp_worker;
|
||||
# end
|
||||
# ^
|
||||
# recreate package body pg_test as
|
||||
# begin
|
||||
# function pg_fn_worker returns int as
|
||||
# begin
|
||||
# return (
|
||||
# select sum(cnt)
|
||||
# from (
|
||||
# select count(*) as cnt
|
||||
# from test group by x
|
||||
# plan (TEST ORDER TEST_X)
|
||||
# union all
|
||||
# select cnt from v_worker
|
||||
# )
|
||||
# );
|
||||
# end
|
||||
#
|
||||
# procedure pg_sp_worker as
|
||||
# declare c int;
|
||||
# begin
|
||||
# select sum(cnt)
|
||||
# from (
|
||||
# select count(*) as cnt
|
||||
# from test group by x
|
||||
# plan (TEST ORDER TEST_X)
|
||||
# union all
|
||||
# select cnt from v_worker
|
||||
# )
|
||||
# into c
|
||||
# ;
|
||||
# end
|
||||
#
|
||||
# end
|
||||
# ^
|
||||
#
|
||||
# create or alter trigger trg_attach active on connect position 0 as
|
||||
# declare c int;
|
||||
# begin
|
||||
# if ( rdb$get_context('USER_SESSION','INITIAL_DDL') is null ) then
|
||||
# begin
|
||||
# select sum(cnt)
|
||||
# from (
|
||||
# select count(*) as cnt
|
||||
# from test group by x
|
||||
# plan (TEST ORDER TEST_X)
|
||||
# union all
|
||||
# select cnt from v_worker
|
||||
# )
|
||||
# into c;
|
||||
# end
|
||||
# end
|
||||
# ^
|
||||
# set term ;^
|
||||
# commit;
|
||||
# ''' % dict(globals(), **locals())
|
||||
#
|
||||
# f_init_sql=open( os.path.join(context['temp_directory'],'tmp_1725_init.sql'), 'w')
|
||||
# f_init_sql.write(sql_init)
|
||||
# f_init_sql.close()
|
||||
#
|
||||
# f_init_log=open( os.path.join(context['temp_directory'],'tmp_1725_init.log'), 'w', buffering = 0)
|
||||
# f_init_err=open( os.path.join(context['temp_directory'],'tmp_1725_init.err'), 'w', buffering = 0)
|
||||
# subprocess.call( [ context['isql_path'], '-q', '-i', f_init_sql.name], stdout=f_init_log, stderr=f_init_err )
|
||||
# flush_and_close( f_init_log )
|
||||
# flush_and_close( f_init_err )
|
||||
#
|
||||
# #----------------------------------------------------------------------
|
||||
#
|
||||
# # Extract metadata from initial DB:
|
||||
# ##################
|
||||
# f_meta_init=open( os.path.join(context['temp_directory'],'tmp_1725_meta.init.sql'), 'w', buffering = 0)
|
||||
# subprocess.call( [ context['isql_path'], '-nod', '-x', 'localhost:'+tmp_initdb ], stdout=f_meta_init, stderr=subprocess.STDOUT )
|
||||
# flush_and_close( f_meta_init )
|
||||
#
|
||||
# #----------------------------------------------------------------------
|
||||
#
|
||||
# # backup + restore _WITHOUT_ building indices:
|
||||
# ###################
|
||||
# # https://docs.python.org/2/library/subprocess.html#replacing-shell-pipeline
|
||||
# p_sender = subprocess.Popen( [ context['gbak_path'], '-b', 'localhost:'+tmp_initdb, 'stdout' ], stdout=PIPE)
|
||||
# p_getter = subprocess.Popen( [ context['gbak_path'], '-c', '-i', 'stdin', tmp_restdb ], stdin = p_sender.stdout, stdout = PIPE )
|
||||
# p_sender.stdout.close()
|
||||
# p_getter_stdout, p_getter_stderr = p_getter.communicate()
|
||||
#
|
||||
# #----------------------------------------------------------------------
|
||||
#
|
||||
# # Get FB log before validation, run validation and get FB log after it:
|
||||
# ############
|
||||
# f_fblog_before=open( os.path.join(context['temp_directory'],'tmp_1725_fblog_before_validation.txt'), 'w')
|
||||
# svc_get_fb_log( f_fblog_before )
|
||||
# flush_and_close( f_fblog_before )
|
||||
#
|
||||
# f_validate_log=open( os.path.join(context['temp_directory'],'tmp_1725_validate.log'), 'w', buffering = 0)
|
||||
# f_validate_err=open( os.path.join(context['temp_directory'],'tmp_1725_validate.err'), 'w', buffering = 0)
|
||||
# subprocess.call( [ context['gfix_path'], '-v', '-full', 'localhost:'+tmp_restdb ], stdout=f_validate_log, stderr=f_validate_err )
|
||||
# flush_and_close( f_validate_log )
|
||||
# flush_and_close( f_validate_err )
|
||||
#
|
||||
# f_fblog_after=open( os.path.join(context['temp_directory'],'tmp_1725_fblog__after_validation.txt'), 'w')
|
||||
# svc_get_fb_log( f_fblog_after )
|
||||
# flush_and_close( f_fblog_after )
|
||||
#
|
||||
# #----------------------------------------------------------------------
|
||||
# shutil.move(tmp_restdb, tmp_initdb)
|
||||
# #----------------------------------------------------------------------
|
||||
#
|
||||
# # Extract metadata from restored DB:
|
||||
# ##################
|
||||
# f_meta_rest=open( os.path.join(context['temp_directory'],'tmp_1725_meta.rest.sql'), 'w', buffering = 0)
|
||||
# subprocess.call( [ context['isql_path'], '-nod', '-x', 'localhost:'+tmp_initdb ], stdout=f_meta_rest, stderr=subprocess.STDOUT )
|
||||
# flush_and_close( f_meta_rest )
|
||||
#
|
||||
# #----------------------------------------------------------------------
|
||||
#
|
||||
# oldmeta=open(f_meta_init.name, 'r')
|
||||
# newmeta=open(f_meta_rest.name, 'r')
|
||||
#
|
||||
# diffmeta = ''.join(difflib.unified_diff(
|
||||
# oldmeta.readlines(),
|
||||
# newmeta.readlines()
|
||||
# ))
|
||||
# oldmeta.close()
|
||||
# newmeta.close()
|
||||
#
|
||||
# f_meta_diff=open( os.path.join(context['temp_directory'],'tmp_1725_meta_diff.txt'), 'w', buffering = 0)
|
||||
# f_meta_diff.write(diffmeta)
|
||||
# flush_and_close( f_meta_diff )
|
||||
#
|
||||
# #----------------------------------------------------------------------
|
||||
#
|
||||
# # Compare firebird.log versions BEFORE and AFTER this test:
|
||||
# ######################
|
||||
#
|
||||
# oldfb=open(f_fblog_before.name, 'r')
|
||||
# newfb=open(f_fblog_after.name, 'r')
|
||||
#
|
||||
# difftext = ''.join(difflib.unified_diff(
|
||||
# oldfb.readlines(),
|
||||
# newfb.readlines()
|
||||
# ))
|
||||
# oldfb.close()
|
||||
# newfb.close()
|
||||
#
|
||||
# f_diff_txt=open( os.path.join(context['temp_directory'],'tmp_5719_valid_diff.txt'), 'w', buffering = 0)
|
||||
# f_diff_txt.write(difftext)
|
||||
# flush_and_close( f_diff_txt )
|
||||
#
|
||||
# #-----------------------------------------------------------------------
|
||||
#
|
||||
# # CHECKS:
|
||||
# #########
|
||||
#
|
||||
# # Logs of initial .sql must be empty.
|
||||
# # Result of diff in extracted metadata .sql must be empty.
|
||||
# # Output of 'gfix -v -full' must be empty.
|
||||
# for g in (f_init_log, f_init_err, f_meta_diff, f_validate_log, f_validate_err):
|
||||
# with open(g.name, 'r') as f:
|
||||
# for line in f:
|
||||
# if line.split():
|
||||
# print('UNEXPECTED OUTPUT in ' + os.path.split(g.name)[-1] + ': ' + line )
|
||||
#
|
||||
# # Result of diff in firebird.log before and after validation must contain text with ZERO warninngs and ZERO errors:
|
||||
# # + Validation finished: 0 errors, 0 warnings, 0 fixed
|
||||
# with open( f_diff_txt.name,'r') as f:
|
||||
# for line in f:
|
||||
# if line.startswith('+') and 'Validation' in line:
|
||||
# print( line )
|
||||
#
|
||||
# # Cleanup:
|
||||
# ##########
|
||||
#
|
||||
# # do NOT remove this pause otherwise some of logs will not be enable for deletion and test will finish with
|
||||
# # Exception raised while executing Python test script. exception: WindowsError: 32
|
||||
# time.sleep(1)
|
||||
#
|
||||
# cleanup( [ i.name for i in ( f_init_sql, f_init_log, f_init_err, f_meta_init, f_meta_rest, f_meta_diff, f_fblog_before, f_fblog_after, f_validate_log, f_validate_err, f_diff_txt ) ] + [ tmp_initdb, ] )
|
||||
#
|
||||
#
|
||||
#---
|
||||
|
||||
act_1 = python_act('db_1', substitutions=substitutions_1)
|
||||
act = python_act('db')
|
||||
|
||||
@pytest.mark.version('>=3.0.6')
|
||||
def test_1(act_1: Action):
|
||||
def test_1(act: Action):
|
||||
# Extract metadata from initial DB
|
||||
act_1.isql(switches=['-nod', '-x'])
|
||||
meta_1 = act_1.stdout
|
||||
act_1.reset()
|
||||
act.isql(switches=['-nod', '-x'])
|
||||
meta_1 = act.stdout
|
||||
act.reset()
|
||||
# backup + restore _WITHOUT_ building indices:
|
||||
backup = BytesIO()
|
||||
with act_1.connect_server() as srv:
|
||||
srv.database.local_backup(database=act_1.db.db_path, backup_stream=backup)
|
||||
with act.connect_server() as srv:
|
||||
srv.database.local_backup(database=act.db.db_path, backup_stream=backup)
|
||||
backup.seek(0)
|
||||
srv.database.local_restore(backup_stream=backup, database=act_1.db.db_path,
|
||||
srv.database.local_restore(backup_stream=backup, database=act.db.db_path,
|
||||
flags=SrvRestoreFlag.DEACTIVATE_IDX | SrvRestoreFlag.REPLACE)
|
||||
# Get FB log before validation, run validation and get FB log after it:
|
||||
log_before = act_1.get_firebird_log()
|
||||
srv.database.repair(database=act_1.db.db_path, flags=SrvRepairFlag.CORRUPTION_CHECK)
|
||||
#act_1.gfix(switches=['-v', '-full', act_1.db.dsn])
|
||||
log_after = act_1.get_firebird_log()
|
||||
log_before = act.get_firebird_log()
|
||||
srv.database.repair(database=act.db.db_path, flags=SrvRepairFlag.CORRUPTION_CHECK)
|
||||
#act.gfix(switches=['-v', '-full', act.db.dsn])
|
||||
log_after = act.get_firebird_log()
|
||||
# Extract metadata from restored DB
|
||||
act_1.isql(switches=['-nod', '-x'])
|
||||
meta_2 = act_1.stdout
|
||||
act_1.reset()
|
||||
act.isql(switches=['-nod', '-x'])
|
||||
meta_2 = act.stdout
|
||||
act.reset()
|
||||
# Restore with indices. This is necessary to drop the database safely otherwise connect
|
||||
# to drop will fail in test treadown as connect trigger referes to index tat was not activated
|
||||
with act_1.connect_server() as srv:
|
||||
with act.connect_server() as srv:
|
||||
backup.seek(0)
|
||||
srv.database.local_restore(backup_stream=backup, database=act_1.db.db_path,
|
||||
srv.database.local_restore(backup_stream=backup, database=act.db.db_path,
|
||||
flags=SrvRestoreFlag.REPLACE)
|
||||
#
|
||||
diff_meta = ''.join(unified_diff(meta_1.splitlines(), meta_2.splitlines()))
|
||||
|
@ -1,37 +1,33 @@
|
||||
#coding:utf-8
|
||||
#
|
||||
# id: bugs.core_1735
|
||||
# title: Bug in SET DEFAULT statement
|
||||
# decription:
|
||||
# tracker_id: CORE-1735
|
||||
# min_versions: []
|
||||
# versions: 2.5.0
|
||||
# qmid: None
|
||||
|
||||
"""
|
||||
ID: issue-2159
|
||||
ISSUE: 2159
|
||||
TITLE: Bug in SET DEFAULT statement
|
||||
DESCRIPTION:
|
||||
JIRA: CORE-1735
|
||||
"""
|
||||
|
||||
import pytest
|
||||
from firebird.qa import db_factory, isql_act, Action
|
||||
from firebird.qa import *
|
||||
|
||||
# version: 2.5.0
|
||||
# resources: None
|
||||
|
||||
substitutions_1 = []
|
||||
|
||||
init_script_1 = """CREATE TABLE TEST (
|
||||
init_script = """CREATE TABLE TEST (
|
||||
A INTEGER
|
||||
);
|
||||
"""
|
||||
|
||||
db_1 = db_factory(page_size=4096, sql_dialect=3, init=init_script_1)
|
||||
db = db_factory(init=init_script)
|
||||
|
||||
test_script_1 = """ALTER TABLE TEST ADD CHECK (A > 0);
|
||||
test_script = """ALTER TABLE TEST ADD CHECK (A > 0);
|
||||
|
||||
ALTER TABLE TEST ALTER A SET DEFAULT '1000';
|
||||
"""
|
||||
|
||||
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
|
||||
|
||||
|
||||
@pytest.mark.version('>=2.5.0')
|
||||
def test_1(act_1: Action):
|
||||
act_1.execute()
|
||||
act = isql_act('db', test_script)
|
||||
|
||||
@pytest.mark.version('>=3')
|
||||
def test_1(act: Action):
|
||||
try:
|
||||
act.execute()
|
||||
except ExecutionError as e:
|
||||
pytest.fail("Test script execution failed", pytrace=False)
|
||||
|
@ -1,54 +1,45 @@
|
||||
#coding:utf-8
|
||||
#
|
||||
# id: bugs.core_1746
|
||||
# title: Expression index can be created while doing inserts into table
|
||||
# decription:
|
||||
# We check three cases of Tx setting: WAIT, NO WAIT and LOCK TIMEOUT n.
|
||||
#
|
||||
# First ISQL session always inserts some number of rows and falls in delay (it is created
|
||||
# artificially by attempting to insert duplicate key in index in Tx with lock timeout = 7).
|
||||
#
|
||||
# Second ISQL is launched in SYNC mode after small delay (3 seconds) and starts transaction
|
||||
# with corresponding WAIT/NO WAIT/LOCK TIMEOUT clause.
|
||||
#
|
||||
# If Tx starts with NO wait or lock timeout then this (2nd) ISQL always MUST FAIL.
|
||||
#
|
||||
# After 2nd ISQL will finish, we have to wait yet 5 seconds for 1st ISQL will gone.
|
||||
# Total time of these two delays (3+5=8) must be greater than lock timeout in the script which
|
||||
# is running by 1st ISQL (7 seconds).
|
||||
#
|
||||
# Initial version of this test did use force interruption of both ISQL processes but this was unneeded,
|
||||
# though it helped to discover some other bug in engine which produced bugcheck - see CORE-5275.
|
||||
#
|
||||
# Checked on:
|
||||
# 4.0.0.2164 SS: 37.707s.
|
||||
# 4.0.0.2119 SS: 37.982s.
|
||||
# 4.0.0.2164 CS: 39.116s.
|
||||
# 3.0.7.33356 SS: 36.675s.
|
||||
# 3.0.7.33356 CS: 37.839s.
|
||||
# 2.5.9.27150 SC: 35.755s.
|
||||
#
|
||||
# tracker_id: CORE-1746
|
||||
# min_versions: ['2.5.6']
|
||||
# versions: 2.5.6
|
||||
# qmid: None
|
||||
|
||||
"""
|
||||
ID: issue-2170
|
||||
ISSUE: 2170
|
||||
TITLE: Expression index can be created while doing inserts into table
|
||||
DESCRIPTION:
|
||||
We check three cases of Tx setting: WAIT, NO WAIT and LOCK TIMEOUT n.
|
||||
|
||||
First ISQL session always inserts some number of rows and falls in delay (it is created
|
||||
artificially by attempting to insert duplicate key in index in Tx with lock timeout = 7).
|
||||
|
||||
Second ISQL is launched in SYNC mode after small delay (3 seconds) and starts transaction
|
||||
with corresponding WAIT/NO WAIT/LOCK TIMEOUT clause.
|
||||
|
||||
If Tx starts with NO wait or lock timeout then this (2nd) ISQL always MUST FAIL.
|
||||
|
||||
After 2nd ISQL will finish, we have to wait yet 5 seconds for 1st ISQL will gone.
|
||||
Total time of these two delays (3+5=8) must be greater than lock timeout in the script which
|
||||
is running by 1st ISQL (7 seconds).
|
||||
|
||||
Initial version of this test did use force interruption of both ISQL processes but this was unneeded,
|
||||
though it helped to discover some other bug in engine which produced bugcheck - see CORE-5275.
|
||||
NOTES:
|
||||
[15.1.2022] pcisar
|
||||
This test may FAIL when run on slow machine (like VM)!
|
||||
JIRA: CORE-1746
|
||||
"""
|
||||
|
||||
import pytest
|
||||
import time
|
||||
import subprocess
|
||||
from pathlib import Path
|
||||
from firebird.qa import db_factory, python_act, Action, temp_file
|
||||
from firebird.qa import *
|
||||
|
||||
# version: 2.5.6
|
||||
# resources: None
|
||||
substitutions = [('0: CREATE INDEX LOG: RDB_EXPR_BLOB.*', '0: CREATE INDEX LOG: RDB_EXPR_BLOB'),
|
||||
('BULK_INSERT_START.*', 'BULK_INSERT_START'),
|
||||
('BULK_INSERT_FINISH.*', 'BULK_INSERT_FINISH'),
|
||||
('CREATE_INDX_START.*', 'CREATE_INDX_START'),
|
||||
('AFTER LINE.*', 'AFTER LINE')]
|
||||
|
||||
substitutions_1 = [('0: CREATE INDEX LOG: RDB_EXPR_BLOB.*', '0: CREATE INDEX LOG: RDB_EXPR_BLOB'),
|
||||
('BULK_INSERT_START.*', 'BULK_INSERT_START'),
|
||||
('BULK_INSERT_FINISH.*', 'BULK_INSERT_FINISH'),
|
||||
('CREATE_INDX_START.*', 'CREATE_INDX_START'),
|
||||
('AFTER LINE.*', 'AFTER LINE')]
|
||||
|
||||
init_script_1 = """
|
||||
init_script = """
|
||||
create or alter procedure sp_ins(n int) as begin end;
|
||||
|
||||
recreate table test(x int unique using index test_x, s varchar(10) default 'qwerty' );
|
||||
@ -79,207 +70,14 @@ init_script_1 = """
|
||||
commit;
|
||||
"""
|
||||
|
||||
db_1 = db_factory(sql_dialect=3, init=init_script_1)
|
||||
db = db_factory(init=init_script)
|
||||
|
||||
# test_script_1
|
||||
#---
|
||||
# import os
|
||||
# import time
|
||||
# import subprocess
|
||||
#
|
||||
# os.environ["ISC_USER"] = user_name
|
||||
# os.environ["ISC_PASSWORD"] = user_password
|
||||
#
|
||||
# db_conn.close()
|
||||
#
|
||||
# #--------------------------------------------
|
||||
#
|
||||
# def flush_and_close(file_handle):
|
||||
# # https://docs.python.org/2/library/os.html#os.fsync
|
||||
# # If you're starting with a Python file object f,
|
||||
# # first do f.flush(), and
|
||||
# # then do os.fsync(f.fileno()), to ensure that all internal buffers associated with f are written to disk.
|
||||
# global os
|
||||
#
|
||||
# file_handle.flush()
|
||||
# if file_handle.mode not in ('r', 'rb'):
|
||||
# # otherwise: "OSError: [Errno 9] Bad file descriptor"!
|
||||
# os.fsync(file_handle.fileno())
|
||||
# file_handle.close()
|
||||
#
|
||||
# #--------------------------------------------
|
||||
#
|
||||
# def cleanup( f_names_list ):
|
||||
# global os
|
||||
# for i in range(len( f_names_list )):
|
||||
# if os.path.isfile( f_names_list[i]):
|
||||
# os.remove( f_names_list[i] )
|
||||
#
|
||||
#
|
||||
# #########################################################
|
||||
#
|
||||
# # NB-1: value of 'rows_to_add' must have value that will require at least
|
||||
# # 4...5 seconds for inserting such number of rows
|
||||
# # NB-2: FB 2.5 makes DML *faster* than 3.0 in single-connection mode!
|
||||
#
|
||||
# rows_to_add=1000
|
||||
#
|
||||
# sql_bulk_insert=''' set bail on;
|
||||
# set list on;
|
||||
#
|
||||
# -- do NOT use it !! >>> alter sequence g restart with 0; -- gen_id(g,1) will return 0 rather than 1 since 06-aug-2020 on FB 4.x !!
|
||||
#
|
||||
# delete from test;
|
||||
# set term ^;
|
||||
# execute block as
|
||||
# declare c bigint;
|
||||
# begin
|
||||
# c = gen_id(g, -gen_id(g, 0)); -- restart sequence
|
||||
# end
|
||||
# ^
|
||||
# set term ;^
|
||||
# commit;
|
||||
#
|
||||
# set transaction lock timeout 7; -- THIS LOCK TIMEOUT SERVES ONLY FOR DELAY, see below auton Tx start.
|
||||
#
|
||||
# select current_timestamp as bulk_insert_start from rdb$database;
|
||||
# set term ^;
|
||||
# execute block as
|
||||
# declare i int;
|
||||
# begin
|
||||
# execute procedure sp_ins( %(rows_to_add)s );
|
||||
# begin
|
||||
# -- #########################################################
|
||||
# -- ####################### D E L A Y #####################
|
||||
# -- #########################################################
|
||||
# in autonomous transaction do
|
||||
# insert into test( x ) values( %(rows_to_add)s ); -- this will cause delay because of duplicate in index
|
||||
# when any do
|
||||
# begin
|
||||
# i = gen_id(g,1);
|
||||
# end
|
||||
# end
|
||||
# end
|
||||
# ^
|
||||
# set term ;^
|
||||
# commit;
|
||||
# select current_timestamp as bulk_insert_finish from rdb$database;
|
||||
# '''
|
||||
#
|
||||
# sql_create_indx=''' set bail on;
|
||||
# set list on;
|
||||
# set blob all;
|
||||
# select
|
||||
# iif( gen_id(g,0) > 0 and gen_id(g,0) < 1 + %(rows_to_add)s,
|
||||
# 'OK, IS RUNNING',
|
||||
# iif( gen_id(g,0) <=0,
|
||||
# 'WRONG: not yet started, current gen_id='||gen_id(g,0),
|
||||
# 'WRONG: already finished, rows_to_add='||%(rows_to_add)s ||', current gen_id='||gen_id(g,0)
|
||||
# )
|
||||
# ) as inserts_state,
|
||||
# current_timestamp as create_indx_start
|
||||
# from rdb$database;
|
||||
# set autoddl off;
|
||||
# commit;
|
||||
#
|
||||
# set echo on;
|
||||
# set transaction %(tx_decl)s;
|
||||
#
|
||||
# create index test_%(idx_name)s on test computed by( %(idx_expr)s );
|
||||
# commit;
|
||||
# set echo off;
|
||||
#
|
||||
# select
|
||||
# iif( gen_id(g,0) >= 1 + %(rows_to_add)s,
|
||||
# 'OK, FINISHED',
|
||||
# 'SOMETHING WRONG: current gen_id=' || gen_id(g,0)||', rows_to_add='||%(rows_to_add)s
|
||||
# ) as inserts_state
|
||||
# from rdb$database;
|
||||
#
|
||||
# set count on;
|
||||
# select
|
||||
# rdb$index_name
|
||||
# ,coalesce(rdb$unique_flag,0) as rdb$unique_flag
|
||||
# ,coalesce(rdb$index_inactive,0) as rdb$index_inactive
|
||||
# ,rdb$expression_source as rdb_expr_blob
|
||||
# from rdb$indices ri
|
||||
# where ri.rdb$index_name = upper( 'test_%(idx_name)s' )
|
||||
# ;
|
||||
# set count off;
|
||||
# set echo on;
|
||||
# set plan on;
|
||||
# select 1 from test where %(idx_expr)s > '' rows 0;
|
||||
# set plan off;
|
||||
# set echo off;
|
||||
# commit;
|
||||
# drop index test_%(idx_name)s;
|
||||
# commit;
|
||||
# '''
|
||||
#
|
||||
# tx_param=['WAIT','NO WAIT','LOCK TIMEOUT 1']
|
||||
#
|
||||
# for i in range(len(tx_param)):
|
||||
#
|
||||
# #if i >= 2:
|
||||
# # continue # temply!
|
||||
#
|
||||
# f_bulk_insert_sql = open( os.path.join(context['temp_directory'],'tmp_1746_ins.sql'), 'w')
|
||||
# f_bulk_insert_sql.write(sql_bulk_insert % locals() )
|
||||
# f_bulk_insert_sql.close()
|
||||
#
|
||||
# tx_decl=tx_param[i]
|
||||
# idx_name=tx_decl.replace(' ','_')
|
||||
# idx_expr="'"+idx_name+"'|| s"
|
||||
#
|
||||
# f_create_indx_sql = open( os.path.join(context['temp_directory'],'tmp_1746_idx_%s.sql' % str(i) ), 'w')
|
||||
# f_create_indx_sql.write( sql_create_indx % locals() )
|
||||
# f_create_indx_sql.close()
|
||||
#
|
||||
# f_bulk_insert_log = open( os.path.join(context['temp_directory'],'tmp_1746_ins_%s.log' % str(i) ), 'w')
|
||||
#
|
||||
# # This will insert rows and then stay in pause 10 seconds:
|
||||
# p_bulk_insert=subprocess.Popen( [ context['isql_path'], dsn, "-q", "-i", f_bulk_insert_sql.name ],
|
||||
# stdout = f_bulk_insert_log,
|
||||
# stderr = subprocess.STDOUT
|
||||
# )
|
||||
#
|
||||
# # 3.0 Classic: seems that it requires at least 2 seconds for ISQL be loaded into memory.
|
||||
# time.sleep(3)
|
||||
#
|
||||
# f_create_indx_log = open( os.path.join(context['temp_directory'],'tmp_1746_idx_%s.log' % str(i) ), 'w')
|
||||
#
|
||||
# # This will wait until first ISQL finished:
|
||||
# subprocess.call( [ context['isql_path'], dsn, "-n", "-q", "-i", f_create_indx_sql.name ],
|
||||
# stdout = f_create_indx_log,
|
||||
# stderr = subprocess.STDOUT
|
||||
# )
|
||||
#
|
||||
# time.sleep(7) # NB: this delay plus previous (3+5=8) must be GREATER than lock timeout in <sql_bulk_insert>
|
||||
#
|
||||
# p_bulk_insert.terminate()
|
||||
# flush_and_close( f_bulk_insert_log )
|
||||
# flush_and_close( f_create_indx_log )
|
||||
#
|
||||
#
|
||||
# with open( f_bulk_insert_log.name,'r') as f:
|
||||
# for line in f:
|
||||
# if line.split():
|
||||
# print( str(i)+': BULK INSERTS LOG: '+line.strip().upper() )
|
||||
#
|
||||
# with open( f_create_indx_log.name,'r') as f:
|
||||
# for line in f:
|
||||
# if line.split():
|
||||
# print( str(i)+': CREATE INDEX LOG: '+line.strip().upper() )
|
||||
#
|
||||
# cleanup( [i.name for i in (f_bulk_insert_sql, f_create_indx_sql, f_bulk_insert_log, f_create_indx_log)] )
|
||||
#---
|
||||
|
||||
act_1 = python_act('db_1', substitutions=substitutions_1)
|
||||
act = python_act('db', substitutions=substitutions)
|
||||
|
||||
tmp_file_bi_in = temp_file('bulk_insert.sql')
|
||||
tmp_file_bi_out = temp_file('bulk_insert.out')
|
||||
|
||||
expected_stdout_1 = """
|
||||
expected_stdout = """
|
||||
0: BULK INSERTS LOG: BULK_INSERT_START
|
||||
0: BULK INSERTS LOG: BULK_INSERT_FINISH
|
||||
0: CREATE INDEX LOG: INSERTS_STATE OK, IS RUNNING
|
||||
@ -326,11 +124,8 @@ expected_stdout_1 = """
|
||||
2: CREATE INDEX LOG: -OBJECT TABLE "TEST" IS IN USE
|
||||
"""
|
||||
|
||||
@pytest.mark.version('>=2.5.6')
|
||||
def test_1(act_1: Action, tmp_file_bi_in: Path, tmp_file_bi_out: Path, capsys):
|
||||
# NB-1: value of 'rows_to_add' must have value that will require at least
|
||||
# 4...5 seconds for inserting such number of rows
|
||||
# NB-2: FB 2.5 makes DML *faster* than 3.0 in single-connection mode!
|
||||
@pytest.mark.version('>=3')
|
||||
def test_1(act: Action, tmp_file_bi_in: Path, tmp_file_bi_out: Path, capsys):
|
||||
rows_to_add = 1000
|
||||
tmp_file_bi_in.write_text (f'''
|
||||
set bail on;
|
||||
@ -435,41 +230,39 @@ def test_1(act_1: Action, tmp_file_bi_in: Path, tmp_file_bi_out: Path, capsys):
|
||||
'''
|
||||
with open(tmp_file_bi_out, mode='w') as f_bulk_insert_log:
|
||||
# This will insert rows and then stay in pause 10 seconds:
|
||||
p_bulk_insert = subprocess.Popen([act_1.vars['isql'], act_1.db.dsn,
|
||||
'-user', act_1.db.user,
|
||||
'-password', act_1.db.password,
|
||||
p_bulk_insert = subprocess.Popen([act.vars['isql'], act.db.dsn,
|
||||
'-user', act.db.user,
|
||||
'-password', act.db.password,
|
||||
'-q', '-i', str(tmp_file_bi_in)],
|
||||
stdout = f_bulk_insert_log,
|
||||
stderr = subprocess.STDOUT
|
||||
)
|
||||
#act_1.isql(switches=['-q'], input=sql_bulk_insert)
|
||||
#bulk_insert_log = act_1.stdout
|
||||
#act.isql(switches=['-q'], input=sql_bulk_insert)
|
||||
#bulk_insert_log = act.stdout
|
||||
# 3.0 Classic: seems that it requires at least 2 seconds for ISQL be loaded into memory.
|
||||
time.sleep(3)
|
||||
# This will wait until first ISQL finished
|
||||
act_1.expected_stderr = 'DISABLED'
|
||||
act_1.isql(switches=['-q', '-n'], input=sql_create_indx)
|
||||
act.expected_stderr = 'DISABLED'
|
||||
act.isql(switches=['-q', '-n'], input=sql_create_indx)
|
||||
time.sleep(7) # NB: this delay plus previous (3+5=8) must be GREATER than lock timeout in <sql_bulk_insert>
|
||||
|
||||
p_bulk_insert.terminate()
|
||||
bulk_insert_log = tmp_file_bi_out.read_text()
|
||||
create_indx_log = act_1.stdout + act_1.stderr
|
||||
create_indx_log = act.stdout + act.stderr
|
||||
|
||||
log = act_1.string_strip(bulk_insert_log, act_1.substitutions)
|
||||
log = act.string_strip(bulk_insert_log, act.substitutions)
|
||||
for line in log.splitlines():
|
||||
if line.strip():
|
||||
print( str(i)+': BULK INSERTS LOG: '+line.strip().upper() )
|
||||
|
||||
log = act_1.string_strip(create_indx_log, act_1.substitutions)
|
||||
log = act.string_strip(create_indx_log, act.substitutions)
|
||||
for line in log.splitlines():
|
||||
if line.strip():
|
||||
print( str(i)+': CREATE INDEX LOG: '+line.strip().upper() )
|
||||
#
|
||||
i += 1
|
||||
# Checks
|
||||
act_1.reset()
|
||||
act_1.stdout = capsys.readouterr().out
|
||||
act_1.expected_stdout = expected_stdout_1
|
||||
# pcisar [15.1.2022]
|
||||
# This test may FAIL when run on slow machine (like VM)!
|
||||
assert act_1.clean_stdout == act_1.clean_expected_stdout
|
||||
act.reset()
|
||||
act.stdout = capsys.readouterr().out
|
||||
act.expected_stdout = expected_stdout
|
||||
assert act.clean_stdout == act.clean_expected_stdout
|
||||
|
@ -1,26 +1,26 @@
|
||||
#coding:utf-8
|
||||
#
|
||||
# id: bugs.core_1749
|
||||
# title: DDL statement with AUTODDL ON won't show statistics
|
||||
# decription:
|
||||
# tracker_id: CORE-1749
|
||||
# min_versions: []
|
||||
# versions: 2.5.0
|
||||
# qmid: None
|
||||
|
||||
"""
|
||||
ID: issue-2174
|
||||
ISSUE: 2174
|
||||
TITLE: DDL statement with AUTODDL ON won't show statistics
|
||||
DESCRIPTION:
|
||||
JIRA: CORE-1749
|
||||
"""
|
||||
|
||||
import pytest
|
||||
from firebird.qa import db_factory, isql_act, Action
|
||||
from firebird.qa import *
|
||||
|
||||
# version: 2.5.0
|
||||
# resources: None
|
||||
substitutions = [('^Current memory.*', ''), ('^Delta memory.*', ''),
|
||||
('^Max memory.*', ''), ('^Elapsed time.*', ''), ('^Buffers.*', ''),
|
||||
('^Reads.*', ''), ('^Writes.*', ''), ('^Elapsed time.*', ''),
|
||||
('^Cpu.*', ''), ('^Fetches.*', 'STATS')]
|
||||
|
||||
substitutions_1 = [('^Current memory.*', ''), ('^Delta memory.*', ''), ('^Max memory.*', ''), ('^Elapsed time.*', ''), ('^Buffers.*', ''), ('^Reads.*', ''), ('^Writes.*', ''), ('^Elapsed time.*', ''), ('^Cpu.*', ''), ('^Fetches.*', 'STATS')]
|
||||
init_script = """"""
|
||||
|
||||
init_script_1 = """"""
|
||||
db = db_factory(init=init_script)
|
||||
|
||||
db_1 = db_factory(page_size=4096, sql_dialect=3, init=init_script_1)
|
||||
|
||||
test_script_1 = """set stat on;
|
||||
test_script = """set stat on;
|
||||
|
||||
create generator A;
|
||||
|
||||
@ -31,16 +31,16 @@ commit;
|
||||
|
||||
"""
|
||||
|
||||
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
|
||||
act = isql_act('db', test_script, substitutions=substitutions)
|
||||
|
||||
expected_stdout_1 = """STATS
|
||||
expected_stdout = """STATS
|
||||
STATS
|
||||
STATS
|
||||
"""
|
||||
|
||||
@pytest.mark.version('>=2.5.0')
|
||||
def test_1(act_1: Action):
|
||||
act_1.expected_stdout = expected_stdout_1
|
||||
act_1.execute()
|
||||
assert act_1.clean_stdout == act_1.clean_expected_stdout
|
||||
@pytest.mark.version('>=3')
|
||||
def test_1(act: Action):
|
||||
act.expected_stdout = expected_stdout
|
||||
act.execute()
|
||||
assert act.clean_stdout == act.clean_expected_stdout
|
||||
|
||||
|
@ -1,26 +1,19 @@
|
||||
#coding:utf-8
|
||||
#
|
||||
# id: bugs.core_1750
|
||||
# title: Include information about context variables into the monitoring tables
|
||||
# decription:
|
||||
# tracker_id: CORE-1750
|
||||
# min_versions: ['2.5.0']
|
||||
# versions: 2.5.0
|
||||
# qmid: None
|
||||
|
||||
"""
|
||||
ID: issue-2175
|
||||
ISSUE: 2175
|
||||
TITLE: Include information about context variables into the monitoring tables
|
||||
DESCRIPTION:
|
||||
JIRA: CORE-1750
|
||||
"""
|
||||
|
||||
import pytest
|
||||
from firebird.qa import db_factory, isql_act, Action
|
||||
from firebird.qa import *
|
||||
|
||||
# version: 2.5.0
|
||||
# resources: None
|
||||
db = db_factory()
|
||||
|
||||
substitutions_1 = []
|
||||
|
||||
init_script_1 = """"""
|
||||
|
||||
db_1 = db_factory(sql_dialect=3, init=init_script_1)
|
||||
|
||||
test_script_1 = """
|
||||
test_script = """
|
||||
set list on;
|
||||
set count on;
|
||||
select mon$variable_name, mon$variable_value from mon$context_variables;
|
||||
@ -44,22 +37,22 @@ test_script_1 = """
|
||||
^
|
||||
"""
|
||||
|
||||
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
|
||||
act = isql_act('db', test_script)
|
||||
|
||||
expected_stdout_1 = """
|
||||
expected_stdout = """
|
||||
Records affected: 0
|
||||
|
||||
MON$VARIABLE_NAME SESSION_LEVEL_VARIABLE
|
||||
MON$VARIABLE_VALUE 1
|
||||
MON$VARIABLE_NAME TRANSACTION_LEVEL_VARIABLE
|
||||
MON$VARIABLE_VALUE 1
|
||||
|
||||
Records affected: 2
|
||||
|
||||
Records affected: 2
|
||||
"""
|
||||
|
||||
@pytest.mark.version('>=2.5.0')
|
||||
def test_1(act_1: Action):
|
||||
act_1.expected_stdout = expected_stdout_1
|
||||
act_1.execute()
|
||||
assert act_1.clean_stdout == act_1.clean_expected_stdout
|
||||
@pytest.mark.version('>=3')
|
||||
def test_1(act: Action):
|
||||
act.expected_stdout = expected_stdout
|
||||
act.execute()
|
||||
assert act.clean_stdout == act.clean_expected_stdout
|
||||
|
||||
|
@ -1,71 +1,64 @@
|
||||
#coding:utf-8
|
||||
#
|
||||
# id: bugs.core_1752
|
||||
# title: Results of a join with different collations depend on the execution plan
|
||||
# decription:
|
||||
# tracker_id: CORE-1752
|
||||
# min_versions: ['2.5.1']
|
||||
# versions: 2.5.1
|
||||
# qmid: None
|
||||
|
||||
"""
|
||||
ID: issue-2177
|
||||
ISSUE: 2177
|
||||
TITLE: Results of a join with different collations depend on the execution plan
|
||||
DESCRIPTION:
|
||||
JIRA: CORE-1752
|
||||
"""
|
||||
|
||||
import pytest
|
||||
from firebird.qa import db_factory, isql_act, Action
|
||||
from firebird.qa import *
|
||||
|
||||
# version: 2.5.1
|
||||
# resources: None
|
||||
db = db_factory(from_backup='core1752.fbk')
|
||||
|
||||
substitutions_1 = []
|
||||
|
||||
init_script_1 = """"""
|
||||
|
||||
db_1 = db_factory(from_backup='core1752.fbk', init=init_script_1)
|
||||
|
||||
test_script_1 = """
|
||||
test_script = """
|
||||
select a.zeitstempel, b.artikelnr
|
||||
from t1 a
|
||||
join t2 b on b.artikelnr = a.artikelnr --collate de_de
|
||||
join t2 b on b.artikelnr = a.artikelnr --collate de_de
|
||||
order by 1,2
|
||||
;
|
||||
|
||||
|
||||
select a.zeitstempel, b.artikelnr
|
||||
from t1 a
|
||||
join t2 b on b.artikelnr = a.artikelnr collate de_de
|
||||
join t2 b on b.artikelnr = a.artikelnr collate de_de
|
||||
order by 1,2
|
||||
;
|
||||
"""
|
||||
|
||||
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
|
||||
act = isql_act('db', test_script)
|
||||
|
||||
expected_stdout_1 = """
|
||||
ZEITSTEMPEL ARTIKELNR
|
||||
================================ ===============
|
||||
11997831915bde60630658f7ed147baa 10045
|
||||
1199797956ebe80ac53a54ebd164c707 9930
|
||||
1199798232de53f704854945c17be47e 10005
|
||||
1199799582060cc10385b2eafcdfd567 10045
|
||||
1199799582060cc10385b2eafcdfd567 10056
|
||||
119981802446bba36e437bf0181bb41c 9761
|
||||
119981811832e8ec4bb875a5d54ca202 9510
|
||||
1199823157b3f2d13b93184ab1e3b29d 9703
|
||||
1199827557240a59c5148b42a9374fc9 9920
|
||||
expected_stdout = """
|
||||
ZEITSTEMPEL ARTIKELNR
|
||||
================================ ===============
|
||||
11997831915bde60630658f7ed147baa 10045
|
||||
1199797956ebe80ac53a54ebd164c707 9930
|
||||
1199798232de53f704854945c17be47e 10005
|
||||
1199799582060cc10385b2eafcdfd567 10045
|
||||
1199799582060cc10385b2eafcdfd567 10056
|
||||
119981802446bba36e437bf0181bb41c 9761
|
||||
119981811832e8ec4bb875a5d54ca202 9510
|
||||
1199823157b3f2d13b93184ab1e3b29d 9703
|
||||
1199827557240a59c5148b42a9374fc9 9920
|
||||
|
||||
|
||||
ZEITSTEMPEL ARTIKELNR
|
||||
================================ ===============
|
||||
11997831915bde60630658f7ed147baa 10045
|
||||
1199797956ebe80ac53a54ebd164c707 9930
|
||||
1199798232de53f704854945c17be47e 10005
|
||||
1199799582060cc10385b2eafcdfd567 10045
|
||||
1199799582060cc10385b2eafcdfd567 10056
|
||||
119981802446bba36e437bf0181bb41c 9761
|
||||
119981811832e8ec4bb875a5d54ca202 9510
|
||||
1199823157b3f2d13b93184ab1e3b29d 9703
|
||||
1199827557240a59c5148b42a9374fc9 9920
|
||||
ZEITSTEMPEL ARTIKELNR
|
||||
================================ ===============
|
||||
11997831915bde60630658f7ed147baa 10045
|
||||
1199797956ebe80ac53a54ebd164c707 9930
|
||||
1199798232de53f704854945c17be47e 10005
|
||||
1199799582060cc10385b2eafcdfd567 10045
|
||||
1199799582060cc10385b2eafcdfd567 10056
|
||||
119981802446bba36e437bf0181bb41c 9761
|
||||
119981811832e8ec4bb875a5d54ca202 9510
|
||||
1199823157b3f2d13b93184ab1e3b29d 9703
|
||||
1199827557240a59c5148b42a9374fc9 9920
|
||||
"""
|
||||
|
||||
@pytest.mark.version('>=2.5.1')
|
||||
def test_1(act_1: Action):
|
||||
act_1.expected_stdout = expected_stdout_1
|
||||
act_1.execute()
|
||||
assert act_1.clean_stdout == act_1.clean_expected_stdout
|
||||
@pytest.mark.version('>=3')
|
||||
def test_1(act: Action):
|
||||
act.expected_stdout = expected_stdout
|
||||
act.execute()
|
||||
assert act.clean_stdout == act.clean_expected_stdout
|
||||
|
||||
|
@ -1,38 +1,19 @@
|
||||
#coding:utf-8
|
||||
#
|
||||
# id: bugs.core_1760
|
||||
# title: Support hex numeric and string literals
|
||||
# decription:
|
||||
# See doc\\sql.extensions\\README.hex_literals.txt
|
||||
#
|
||||
# REFACTORED 27.02.2020:
|
||||
# 1) all SQL code was moved into separate file: $files_location/core_1760.sql because it is common for all major FB versions;
|
||||
# 2) added examples from https://firebirdsql.org/refdocs/langrefupd25-bigint.html (see core_1760.sql);
|
||||
# 3) added check for output datatypes (sqlda_display).
|
||||
#
|
||||
# Checked on:
|
||||
# 4.0.0.1789 SS: 1.458s.
|
||||
# 3.0.6.33259 SS: 0.805s.
|
||||
# 2.5.9.27149 SC: 0.397s.
|
||||
#
|
||||
# tracker_id: CORE-1760
|
||||
# min_versions: ['2.5.0']
|
||||
# versions: 3.0
|
||||
# qmid: None
|
||||
|
||||
"""
|
||||
ID: issue-2185
|
||||
ISSUE: 2185
|
||||
TITLE: Support hex numeric and string literals
|
||||
DESCRIPTION: See doc\\sql.extensions\\README.hex_literals.txt
|
||||
JIRA: CORE-1760
|
||||
"""
|
||||
|
||||
import pytest
|
||||
from firebird.qa import db_factory, isql_act, Action
|
||||
from firebird.qa import *
|
||||
|
||||
# version: 3.0
|
||||
# resources: None
|
||||
db = db_factory()
|
||||
|
||||
substitutions_1 = [('.*At line.*', ''), ('-Token unknown.*', '-Token unknown')]
|
||||
|
||||
init_script_1 = """"""
|
||||
|
||||
db_1 = db_factory(sql_dialect=3, init=init_script_1)
|
||||
|
||||
test_script_1 = """
|
||||
test_script = """
|
||||
set list on;
|
||||
|
||||
-- binary literal ::= { x | X } <quote> [ { <hexit> <hexit> }... ] <quote>
|
||||
@ -87,65 +68,10 @@ test_script_1 = """
|
||||
set sqlda_display off;
|
||||
"""
|
||||
|
||||
#---
|
||||
#
|
||||
# import os
|
||||
# import sys
|
||||
# import subprocess
|
||||
# from fdb import services
|
||||
#
|
||||
# os.environ["ISC_USER"] = user_name
|
||||
# os.environ["ISC_PASSWORD"] = user_password
|
||||
#
|
||||
# #--------------------------------------------
|
||||
#
|
||||
# def flush_and_close(file_handle):
|
||||
# # https://docs.python.org/2/library/os.html#os.fsync
|
||||
# # If you're starting with a Python file object f,
|
||||
# # first do f.flush(), and
|
||||
# # then do os.fsync(f.fileno()), to ensure that all internal buffers associated with f are written to disk.
|
||||
# global os
|
||||
#
|
||||
# file_handle.flush()
|
||||
# if file_handle.mode not in ('r', 'rb'):
|
||||
# # otherwise: "OSError: [Errno 9] Bad file descriptor"!
|
||||
# os.fsync(file_handle.fileno())
|
||||
# file_handle.close()
|
||||
#
|
||||
# #--------------------------------------------
|
||||
#
|
||||
# def cleanup( f_names_list ):
|
||||
# global os
|
||||
# for i in range(len( f_names_list )):
|
||||
# if os.path.isfile( f_names_list[i]):
|
||||
# os.remove( f_names_list[i] )
|
||||
# #--------------------------------------------
|
||||
#
|
||||
# db_conn.close()
|
||||
#
|
||||
# sql_chk = os.path.join(context['files_location'],'core_1760.sql')
|
||||
#
|
||||
# f_sql_log = open( os.path.join(context['temp_directory'],'tmp_core_1760.log'), 'w', buffering = 0)
|
||||
# f_sql_err = open( os.path.join(context['temp_directory'],'tmp_core_1760.err'), 'w', buffering = 0)
|
||||
#
|
||||
# subprocess.call( [ context['isql_path'], dsn, '-q', '-i', sql_chk ], stdout = f_sql_log, stderr = f_sql_err)
|
||||
#
|
||||
# flush_and_close( f_sql_log )
|
||||
# flush_and_close( f_sql_err )
|
||||
#
|
||||
# for f in (f_sql_log, f_sql_err):
|
||||
# with open( f.name,'r') as g:
|
||||
# for line in g:
|
||||
# if line.strip():
|
||||
# print( ('STDOUT: ' if f == f_sql_log else 'STDERR: ') + line )
|
||||
#
|
||||
# cleanup( (f_sql_log.name, f_sql_err.name) )
|
||||
#
|
||||
#---
|
||||
act = isql_act('db', test_script,
|
||||
substitutions=[('.*At line.*', ''), ('-Token unknown.*', '-Token unknown')])
|
||||
|
||||
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
|
||||
|
||||
expected_stdout_1 = """
|
||||
expected_stdout = """
|
||||
CONSTANT 11
|
||||
CONSTANT 0123456789
|
||||
CONSTANT 01234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789
|
||||
@ -230,7 +156,7 @@ OUTPUT message field count: 19
|
||||
: table: V_TEST owner: SYSDBA
|
||||
"""
|
||||
|
||||
expected_stderr_1 = """
|
||||
expected_stderr = """
|
||||
Statement failed, SQLSTATE = 42000
|
||||
Dynamic SQL Error
|
||||
-SQL error code = -104
|
||||
@ -245,11 +171,11 @@ Dynamic SQL Error
|
||||
"""
|
||||
|
||||
@pytest.mark.version('>=3.0')
|
||||
def test_1(act_1: Action):
|
||||
act_1.expected_stdout = expected_stdout_1
|
||||
act_1.expected_stderr = expected_stderr_1
|
||||
act_1.execute()
|
||||
assert act_1.clean_stdout == act_1.clean_expected_stdout
|
||||
assert act_1.clean_stderr == act_1.clean_expected_stderr
|
||||
def test_1(act: Action):
|
||||
act.expected_stdout = expected_stdout
|
||||
act.expected_stderr = expected_stderr
|
||||
act.execute()
|
||||
assert (act.clean_stdout == act.clean_expected_stdout and
|
||||
act.clean_stderr == act.clean_expected_stderr)
|
||||
|
||||
|
||||
|
@ -1,26 +1,19 @@
|
||||
#coding:utf-8
|
||||
#
|
||||
# id: bugs.core_1774
|
||||
# title: Problem with COLLATE ES_ES_CI_AI
|
||||
# decription:
|
||||
# tracker_id: CORE-1774
|
||||
# min_versions: ['2.0.7']
|
||||
# versions: 2.0.7
|
||||
# qmid: None
|
||||
|
||||
"""
|
||||
ID: issue-2198
|
||||
ISSUE: 2198
|
||||
TITLE: Problem with COLLATE ES_ES_CI_AI
|
||||
DESCRIPTION:
|
||||
JIRA: CORE-1774
|
||||
"""
|
||||
|
||||
import pytest
|
||||
from firebird.qa import db_factory, isql_act, Action
|
||||
from firebird.qa import *
|
||||
|
||||
# version: 2.0.7
|
||||
# resources: None
|
||||
db = db_factory(charset='ISO8859_1')
|
||||
|
||||
substitutions_1 = []
|
||||
|
||||
init_script_1 = """"""
|
||||
|
||||
db_1 = db_factory(page_size=4096, charset='ISO8859_1', sql_dialect=3, init=init_script_1)
|
||||
|
||||
test_script_1 = """
|
||||
test_script = """
|
||||
recreate table table_a (
|
||||
field_a varchar(100) character set iso8859_1 collate es_es_ci_ai
|
||||
);
|
||||
@ -29,20 +22,20 @@ test_script_1 = """
|
||||
insert into table_a (field_a) values ('Voy a hacer de comer');
|
||||
insert into table_a (field_a) values ('The web is hacked');
|
||||
commit;
|
||||
|
||||
|
||||
set list on;
|
||||
select * from table_a where field_a like '%HACK%';
|
||||
"""
|
||||
|
||||
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
|
||||
act = isql_act('db', test_script)
|
||||
|
||||
expected_stdout_1 = """
|
||||
expected_stdout = """
|
||||
FIELD_A The web is hacked
|
||||
"""
|
||||
|
||||
@pytest.mark.version('>=2.0.7')
|
||||
def test_1(act_1: Action):
|
||||
act_1.expected_stdout = expected_stdout_1
|
||||
act_1.execute()
|
||||
assert act_1.clean_stdout == act_1.clean_expected_stdout
|
||||
@pytest.mark.version('>=3')
|
||||
def test_1(act: Action):
|
||||
act.expected_stdout = expected_stdout
|
||||
act.execute()
|
||||
assert act.clean_stdout == act.clean_expected_stdout
|
||||
|
||||
|
@ -1,31 +1,26 @@
|
||||
#coding:utf-8
|
||||
#
|
||||
# id: bugs.core_1782
|
||||
# title: ISQL crashes when fetching data for a column having alias longer than 30 characters
|
||||
# decription:
|
||||
# tracker_id: CORE-1782
|
||||
# min_versions: ['2.1.7']
|
||||
# versions: 3.0, 4.0
|
||||
# qmid: None
|
||||
|
||||
"""
|
||||
ID: issue-2209
|
||||
ISSUE: 2209
|
||||
TITLE: ISQL crashes when fetching data for a column having alias longer than 30 characters
|
||||
DESCRIPTION:
|
||||
JIRA: CORE-1782
|
||||
"""
|
||||
|
||||
import pytest
|
||||
from firebird.qa import db_factory, isql_act, Action
|
||||
from firebird.qa import *
|
||||
|
||||
db = db_factory()
|
||||
|
||||
# version: 3.0
|
||||
# resources: None
|
||||
|
||||
substitutions_1 = []
|
||||
|
||||
init_script_1 = """"""
|
||||
|
||||
db_1 = db_factory(sql_dialect=3, init=init_script_1)
|
||||
|
||||
test_script_1 = """
|
||||
set list on;
|
||||
select 1 as test567890test567890test567890test567890 from rdb$database;
|
||||
select 1 as test567890test567890test567890test567890 from rdb$database;
|
||||
"""
|
||||
|
||||
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
|
||||
act_1 = isql_act('db', test_script_1)
|
||||
|
||||
expected_stderr_1 = """
|
||||
Statement failed, SQLSTATE = 42000
|
||||
@ -41,24 +36,16 @@ def test_1(act_1: Action):
|
||||
assert act_1.clean_stderr == act_1.clean_expected_stderr
|
||||
|
||||
# version: 4.0
|
||||
# resources: None
|
||||
|
||||
substitutions_2 = [('-At line[:]{0,1}[\\s]+[\\d]+,[\\s]+column[:]{0,1}[\\s]+[\\d]+', '')]
|
||||
|
||||
init_script_2 = """"""
|
||||
|
||||
db_2 = db_factory(sql_dialect=3, init=init_script_2)
|
||||
|
||||
test_script_2 = """
|
||||
-- NB: 4.0 has limit on length of column size = 255 _bytes_ (not characters).
|
||||
-- More complex test see in core_2350.fbt
|
||||
set list on;
|
||||
select 'Check column title, ASCII, width = 256' as
|
||||
select 'Check column title, ASCII, width = 256' as
|
||||
i2345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890i2345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890i23456789012345678901234567890123456
|
||||
from rdb$database;
|
||||
"""
|
||||
|
||||
act_2 = isql_act('db_2', test_script_2, substitutions=substitutions_2)
|
||||
act_2 = isql_act('db', test_script_2,
|
||||
substitutions=[('-At line[:]{0,1}[\\s]+[\\d]+,[\\s]+column[:]{0,1}[\\s]+[\\d]+', '')])
|
||||
|
||||
expected_stderr_2 = """
|
||||
Statement failed, SQLSTATE = 42000
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user