mirror of
https://github.com/FirebirdSQL/firebird-qa.git
synced 2025-01-22 21:43:06 +01:00
New metadata + cleanup
This commit is contained in:
parent
333f1fa604
commit
810bc39fa8
@ -1,36 +1,28 @@
|
||||
#coding:utf-8
|
||||
#
|
||||
# id: bugs.core_3000
|
||||
# title: Error on delete user "ADMIN"
|
||||
# decription:
|
||||
# Also added sample from core-3110
|
||||
#
|
||||
# tracker_id: CORE-3000
|
||||
# min_versions: ['2.5.7']
|
||||
# versions: 2.5.7
|
||||
# qmid: None
|
||||
|
||||
"""
|
||||
ID: issue-3382
|
||||
ISSUE: 3382
|
||||
TITLE: Error on delete user "ADMIN"
|
||||
DESCRIPTION:
|
||||
Also added sample from #3488
|
||||
JIRA: CORE-3000
|
||||
"""
|
||||
|
||||
import pytest
|
||||
from firebird.qa import db_factory, isql_act, Action
|
||||
from firebird.qa import *
|
||||
|
||||
# version: 2.5.7
|
||||
# resources: None
|
||||
db_ = db_factory()
|
||||
|
||||
substitutions_1 = [('-Token unknown - line.*', '-Token unknown')]
|
||||
|
||||
init_script_1 = """"""
|
||||
|
||||
db_1 = db_factory(sql_dialect=3, init=init_script_1)
|
||||
|
||||
test_script_1 = """
|
||||
test_script = """
|
||||
-- Following users should NOT be created:
|
||||
create user 'ADMIN' password '123';
|
||||
create user 'CHECK' password '123';
|
||||
"""
|
||||
|
||||
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
|
||||
act = isql_act('db_', test_script, substitutions=[('-Token unknown - line.*', '-Token unknown')])
|
||||
|
||||
expected_stderr_1 = """
|
||||
expected_stderr = """
|
||||
Statement failed, SQLSTATE = 42000
|
||||
Dynamic SQL Error
|
||||
-SQL error code = -104
|
||||
@ -44,9 +36,9 @@ expected_stderr_1 = """
|
||||
-'CHECK'
|
||||
"""
|
||||
|
||||
@pytest.mark.version('>=2.5.7')
|
||||
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,69 +1,57 @@
|
||||
#coding:utf-8
|
||||
#
|
||||
# id: bugs.core_3003
|
||||
# title: Procedure suspend check may cause restore to fail
|
||||
# decription:
|
||||
# Checked on:
|
||||
# 2.5.9.27126: OK, 0.859s.
|
||||
# 3.0.5.33086: OK, 1.937s.
|
||||
# 4.0.0.1378: OK, 7.516s.
|
||||
#
|
||||
# tracker_id: CORE-3003
|
||||
# min_versions: ['2.1']
|
||||
# versions: 2.1
|
||||
# qmid:
|
||||
|
||||
"""
|
||||
ID: issue-3385
|
||||
ISSUE: 3385
|
||||
TITLE: Procedure suspend check may cause restore to fail
|
||||
DESCRIPTION:
|
||||
JIRA: CORE-3003
|
||||
"""
|
||||
|
||||
import pytest
|
||||
from firebird.qa import db_factory, isql_act, Action
|
||||
from firebird.qa import *
|
||||
|
||||
# version: 2.1
|
||||
# resources: None
|
||||
db = db_factory(from_backup='c3003-ods11.fbk')
|
||||
|
||||
substitutions_1 = [('RDB\\$PROCEDURE_SOURCE.*', '')]
|
||||
|
||||
init_script_1 = """"""
|
||||
|
||||
db_1 = db_factory(from_backup='c3003-ods11.fbk', init=init_script_1)
|
||||
|
||||
test_script_1 = """
|
||||
test_script = """
|
||||
set list on;
|
||||
select rdb$procedure_name, rdb$procedure_source
|
||||
from rdb$procedures
|
||||
select rdb$procedure_name, rdb$procedure_source
|
||||
from rdb$procedures
|
||||
where upper( rdb$procedure_name ) in ( upper('sp_01'), upper('sp_02') )
|
||||
order by rdb$procedure_name
|
||||
;
|
||||
|
||||
select RDB$PROCEDURE_NAME, RDB$PARAMETER_NAME, RDB$PARAMETER_TYPE,RDB$PARAMETER_MECHANISM
|
||||
select RDB$PROCEDURE_NAME, RDB$PARAMETER_NAME, RDB$PARAMETER_TYPE,RDB$PARAMETER_MECHANISM
|
||||
from rdb$procedure_parameters
|
||||
where upper( rdb$procedure_name ) in ( upper('sp_01'), upper('sp_02') )
|
||||
;
|
||||
"""
|
||||
|
||||
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
|
||||
act = isql_act('db', test_script, substitutions=[('RDB\\$PROCEDURE_SOURCE.*', '')])
|
||||
|
||||
expected_stdout_1 = """
|
||||
expected_stdout = """
|
||||
RDB$PROCEDURE_NAME SP_01
|
||||
RDB$PROCEDURE_SOURCE 1a:1
|
||||
begin
|
||||
n = 1;
|
||||
end
|
||||
|
||||
|
||||
RDB$PROCEDURE_NAME SP_02
|
||||
RDB$PROCEDURE_SOURCE 1a:4
|
||||
declare n int;
|
||||
begin
|
||||
select n from sp_01 into n;
|
||||
end
|
||||
|
||||
|
||||
RDB$PROCEDURE_NAME SP_01
|
||||
RDB$PARAMETER_NAME N
|
||||
RDB$PARAMETER_TYPE 1
|
||||
RDB$PARAMETER_MECHANISM 0
|
||||
"""
|
||||
|
||||
@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,203 +1,39 @@
|
||||
#coding:utf-8
|
||||
#
|
||||
# id: bugs.core_3008
|
||||
# title: Add attachment's CHARACTER SET name into corresponding trace records
|
||||
# decription:
|
||||
# 1. Obtain engine_version from built-in context variable.
|
||||
# 2. Make config for trace in proper format according to FB engine version,
|
||||
# with adding invalid element 'foo' instead on boolean ('true' or 'false')
|
||||
# 3. Launch trace session in separate child process using 'FBSVCMGR action_trace_start'
|
||||
# 4. Run ISQL single 'QUIT;' command in order trace session will register connection.
|
||||
# 5. Stop trace session. Output its log with filtering only messages related to connect/disconnect event.
|
||||
#
|
||||
# Checked on: WI-V2.5.5.26916 (SS, SC, CS); WI-V3.0.0.32008 (SS, SC, CS). Result: OK.
|
||||
# ::: NB :::
|
||||
# Several delays (time.sleep) added in main thread because of OS buffering. Couldn't switch this buffering off.
|
||||
#
|
||||
# tracker_id: CORE-3008
|
||||
# min_versions: ['2.5.0']
|
||||
# versions: 2.5
|
||||
# qmid: None
|
||||
|
||||
"""
|
||||
ID: issue-3389
|
||||
ISSUE: 3389
|
||||
TITLE: Add attachment's CHARACTER SET name into corresponding trace records
|
||||
DESCRIPTION:
|
||||
JIRA: CORE-3008
|
||||
"""
|
||||
|
||||
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 = [('^((?!ERROR|ELEMENT|SYSDBA:NONE).)*$', ''),
|
||||
('.*SYSDBA:NONE', 'SYSDBA:NONE'), ('TCPV.*', 'TCP')]
|
||||
act = python_act('db', substitutions=[('^((?!ERROR|ELEMENT|SYSDBA:NONE).)*$', ''),
|
||||
('.*SYSDBA:NONE', 'SYSDBA:NONE'), ('TCPV.*', 'TCP')])
|
||||
|
||||
init_script_1 = """"""
|
||||
|
||||
db_1 = db_factory(sql_dialect=3, init=init_script_1)
|
||||
|
||||
# test_script_1
|
||||
#---
|
||||
# import os
|
||||
# import subprocess
|
||||
# from subprocess import Popen
|
||||
# import time
|
||||
#
|
||||
# os.environ["ISC_USER"] = user_name
|
||||
# os.environ["ISC_PASSWORD"] = user_password
|
||||
#
|
||||
#
|
||||
# # Obtain engine version, 2.5 or 3.0, for make trace config in appropriate format:
|
||||
# engine=str(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'):
|
||||
# # 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] )
|
||||
# if os.path.isfile( f_names_list[i]):
|
||||
# print('ERROR: can not remove file ' + f_names_list[i])
|
||||
#
|
||||
# #--------------------------------------------
|
||||
#
|
||||
# txt25 = '''# Trace config, format for 2.5. Generated auto, do not edit!
|
||||
# <database %[\\\\\\\\/]bugs.core_3008.fdb>
|
||||
# enabled true
|
||||
# time_threshold 0
|
||||
# log_connections true
|
||||
# </database>
|
||||
# '''
|
||||
#
|
||||
# # NOTES ABOUT TRACE CONFIG FOR 3.0:
|
||||
# # 1) Header contains `database` clause in different format vs FB 2.5: its data must be enclosed with '{' '}'
|
||||
# # 2) Name and value must be separated by EQUALITY sign ('=') in FB-3 trace.conf, otherwise we get runtime error:
|
||||
# # element "<. . .>" have no attribute value set
|
||||
#
|
||||
# txt30 = '''# Trace config, format for 3.0. Generated auto, do not edit!
|
||||
# database=%[\\\\\\\\/]bugs.core_3008.fdb
|
||||
# {
|
||||
# enabled = true
|
||||
# time_threshold = 0
|
||||
# log_connections = true
|
||||
# }
|
||||
# '''
|
||||
#
|
||||
# f_trccfg=open( os.path.join(context['temp_directory'],'tmp_trace_3008.cfg'), 'w')
|
||||
# if engine.startswith('2.5'):
|
||||
# f_trccfg.write(txt25)
|
||||
# else:
|
||||
# f_trccfg.write(txt30)
|
||||
# f_trccfg.close()
|
||||
#
|
||||
# #####################################################
|
||||
# # Starting trace session in new child process (async.):
|
||||
#
|
||||
# f_trclog = open( os.path.join(context['temp_directory'],'tmp_trace_3008.log'), 'w')
|
||||
# # Execute a child program in a new process, redirecting STDERR to the same target as of STDOUT:
|
||||
# p_trace=Popen([context['fbsvcmgr_path'], "localhost:service_mgr",
|
||||
# "action_trace_start",
|
||||
# "trc_cfg", f_trccfg.name],
|
||||
# stdout=f_trclog, stderr=subprocess.STDOUT)
|
||||
#
|
||||
# # Wait! Trace session is initialized not instantly!
|
||||
# time.sleep(1)
|
||||
#
|
||||
# sqltxt='''quit;'''
|
||||
#
|
||||
# runProgram('isql',[dsn,'-ch','utf8'],sqltxt)
|
||||
# runProgram('isql',[dsn,'-ch','iso8859_1'],sqltxt)
|
||||
#
|
||||
# # do NOT remove this otherwise trace log can contain only message about its start before being closed!
|
||||
# time.sleep(3)
|
||||
#
|
||||
# #####################################################
|
||||
# # Getting ID of launched trace session and STOP it:
|
||||
#
|
||||
# # Save active trace session info into file for further parsing it and obtain session_id back (for stop):
|
||||
# f_trclst = open( os.path.join(context['temp_directory'],'tmp_trace_3008.lst'), 'w')
|
||||
# subprocess.call([context['fbsvcmgr_path'], "localhost:service_mgr",
|
||||
# "action_trace_list"],
|
||||
# stdout=f_trclst, stderr=subprocess.STDOUT
|
||||
# )
|
||||
# flush_and_close( f_trclst )
|
||||
#
|
||||
# trcssn=0
|
||||
# with open( f_trclst.name,'r') as f:
|
||||
# for line in f:
|
||||
# i=1
|
||||
# if 'Session ID' in line:
|
||||
# for word in line.split():
|
||||
# if i==3:
|
||||
# trcssn=word
|
||||
# i=i+1
|
||||
# break
|
||||
#
|
||||
# # Result: `trcssn` is ID of active trace session. Now we have to terminate it:
|
||||
# f_trclst=open(f_trclst.name,'a')
|
||||
# f_trclst.seek(0,2)
|
||||
# subprocess.call([context['fbsvcmgr_path'], "localhost:service_mgr",
|
||||
# "action_trace_stop",
|
||||
# "trc_id",trcssn],
|
||||
# stdout=f_trclst, stderr=subprocess.STDOUT
|
||||
# )
|
||||
# flush_and_close( f_trclst )
|
||||
#
|
||||
# # Terminate child process of launched trace session (though it should already be killed):
|
||||
# p_trace.terminate()
|
||||
#
|
||||
# flush_and_close( f_trclog )
|
||||
#
|
||||
#
|
||||
# # Output log of trace for comparing it with expected: it must contain only TWO events: TRACE_INIT and TRACE_FINI
|
||||
# # ::: NB ::: Content if trace log is converted to UPPER case in order to reduce change of mismatching with
|
||||
# # updated trace output in some future versions:
|
||||
# with open( f_trclog.name,'r') as f:
|
||||
# print(f.read().upper())
|
||||
#
|
||||
#
|
||||
# # do NOT remove this delay otherwise get access error 'Windows 32'
|
||||
# # (The process cannot access the file because it is being used by another process):
|
||||
# time.sleep(1)
|
||||
#
|
||||
# cleanup( [i.name for i in (f_trccfg, f_trclst, f_trclog ) ] )
|
||||
#
|
||||
#
|
||||
#---
|
||||
|
||||
act_1 = python_act('db_1', substitutions=substitutions_1)
|
||||
|
||||
expected_stdout_1 = """
|
||||
expected_stdout = """
|
||||
SYSDBA:NONE, UTF8, TCP
|
||||
SYSDBA:NONE, UTF8, TCP
|
||||
SYSDBA:NONE, ISO88591, TCP
|
||||
SYSDBA:NONE, ISO88591, TCP
|
||||
"""
|
||||
|
||||
trace_1 = ['log_connections = true',
|
||||
trace = ['log_connections = true',
|
||||
'time_threshold = 0',
|
||||
]
|
||||
|
||||
@pytest.mark.version('>=3.0')
|
||||
def test_1(act_1: Action):
|
||||
with act_1.trace(db_events=trace_1):
|
||||
with act_1.db.connect(charset='utf8'):
|
||||
def test_1(act: Action):
|
||||
with act.trace(db_events=trace):
|
||||
with act.db.connect(charset='utf8'):
|
||||
pass
|
||||
with act_1.db.connect(charset='iso8859_1'):
|
||||
with act.db.connect(charset='iso8859_1'):
|
||||
pass
|
||||
act_1.expected_stdout = expected_stdout_1
|
||||
act_1.trace_to_stdout(upper=True)
|
||||
assert act_1.clean_stdout == act_1.clean_expected_stdout
|
||||
act.expected_stdout = expected_stdout
|
||||
act.trace_to_stdout(upper=True)
|
||||
assert act.clean_stdout == act.clean_expected_stdout
|
||||
|
@ -1,58 +1,50 @@
|
||||
#coding:utf-8
|
||||
#
|
||||
# id: bugs.core_3018
|
||||
# title: Check ability to use RECREATE, ALTER and CREATE OR ALTER SEQUENCE/GENERATOR statements
|
||||
# decription:
|
||||
# NOTE: FB 4.x has incompatible behaviour with all previous versions since build 4.0.0.2131 (06-aug-2020):
|
||||
# statement 'alter sequence <seq_name> restart with 0' changes rdb$generators.rdb$initial_value to -1 thus
|
||||
# next call of gen_id(<seq_name>,1) will return 0 (ZERO!) rather than 1.
|
||||
# See also CORE-6084 and its fix: https://github.com/FirebirdSQL/firebird/commit/23dc0c6297825b2e9006f4d5a2c488702091033d
|
||||
# This is considered as *expected* and is noted in doc/README.incompatibilities.3to4.txt
|
||||
#
|
||||
# For this reason, old code was removed and now test checks only ability to use statements rather than results of them.
|
||||
# Checked on: 4.0.0.2119; 4.0.0.2164; 3.0.7.33356.
|
||||
#
|
||||
# tracker_id: CORE-3018
|
||||
# min_versions: ['3.0']
|
||||
# versions: 3.0
|
||||
# qmid: None
|
||||
|
||||
"""
|
||||
ID: issue-3399
|
||||
ISSUE: 3399
|
||||
TITLE: RECREATE, ALTER and CREATE OR ALTER SEQUENCE/GENERATOR statements
|
||||
DESCRIPTION:
|
||||
FB 4.x has incompatible behaviour with all previous versions since build 4.0.0.2131 (06-aug-2020):
|
||||
statement 'alter sequence <seq_name> restart with 0' changes rdb$generators.rdb$initial_value to -1 thus
|
||||
next call of gen_id(<seq_name>,1) will return 0 (ZERO!) rather than 1.
|
||||
See also CORE-6084 and its fix: https://github.com/FirebirdSQL/firebird/commit/23dc0c6297825b2e9006f4d5a2c488702091033d
|
||||
This is considered as *expected* and is noted in doc/README.incompatibilities.3to4.txt
|
||||
|
||||
For this reason, old code was removed and now test checks only ability to use statements rather than results of them.
|
||||
Checked on: 4.0.0.2119; 4.0.0.2164; 3.0.7.33356.
|
||||
JIRA: CORE-3018
|
||||
"""
|
||||
|
||||
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 = [('end of command.*', 'end of command')]
|
||||
|
||||
init_script_1 = """"""
|
||||
|
||||
db_1 = db_factory(sql_dialect=3, init=init_script_1)
|
||||
|
||||
test_script_1 = """
|
||||
-- Only FIRST of following statements must fail with
|
||||
test_script = """
|
||||
-- Only FIRST of following statements must fail with
|
||||
-- SQLSTATE = 42000 / Dynamic SQL Error / -SQL error code = -104 / -Unexpected end of command.
|
||||
-- All subsequent must pass w/o errors.
|
||||
create or alter sequence g01;
|
||||
|
||||
|
||||
create or alter sequence g02 start with 2;
|
||||
|
||||
|
||||
create or alter sequence g03 start with 2 increment by 3;
|
||||
|
||||
|
||||
create or alter sequence g04 restart increment by 4;
|
||||
|
||||
--#####################################################
|
||||
|
||||
recreate sequence g05;
|
||||
|
||||
|
||||
recreate sequence g06 start with 6;
|
||||
|
||||
|
||||
recreate sequence g07 start with 7 increment by 8;
|
||||
"""
|
||||
|
||||
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
|
||||
act = isql_act('db', test_script, substitutions=[('end of command.*', 'end of command')])
|
||||
|
||||
expected_stderr_1 = """
|
||||
expected_stderr = """
|
||||
Statement failed, SQLSTATE = 42000
|
||||
Dynamic SQL Error
|
||||
-SQL error code = -104
|
||||
@ -60,8 +52,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,71 +1,28 @@
|
||||
#coding:utf-8
|
||||
#
|
||||
# id: bugs.core_3024
|
||||
# title: Error "no current record for fetch operation" after ALTER VIEW
|
||||
# decription:
|
||||
# Confirmed error on: WI-V2.5.6.26962 (SC), fixed on: WI-V2.5.6.26963.
|
||||
# Checked on WI-V3.0.0.32268 (SS, SC, CS).
|
||||
# Checked on fdb version 1.5.
|
||||
#
|
||||
# tracker_id: CORE-3024
|
||||
# min_versions: ['2.5.6']
|
||||
# versions: 2.5.6
|
||||
# qmid: None
|
||||
|
||||
"""
|
||||
ID: issue-3405
|
||||
ISSUE: 3405
|
||||
TITLE: Error "no current record for fetch operation" after ALTER VIEW
|
||||
DESCRIPTION:
|
||||
JIRA: CORE-3024
|
||||
"""
|
||||
|
||||
import pytest
|
||||
from firebird.qa import db_factory, python_act, Action
|
||||
from firebird.qa import *
|
||||
|
||||
# version: 2.5.6
|
||||
# resources: None
|
||||
db = db_factory()
|
||||
|
||||
substitutions_1 = [('-', '')]
|
||||
act = python_act('db', substitutions=[('-', '')])
|
||||
|
||||
init_script_1 = """"""
|
||||
|
||||
db_1 = db_factory(sql_dialect=3, init=init_script_1)
|
||||
|
||||
# test_script_1
|
||||
#---
|
||||
# db_conn.close()
|
||||
#
|
||||
# att1=kdb.connect(dsn=dsn.encode(),user='SYSDBA',password='masterkey')
|
||||
# att2=kdb.connect(dsn=dsn.encode(),user='SYSDBA',password='masterkey')
|
||||
#
|
||||
# trn1=att1.trans()
|
||||
#
|
||||
# cur1=trn1.cursor()
|
||||
#
|
||||
# cur1.execute("create table t(a int, b int, c int)") # att_12, tra_4
|
||||
# cur1.execute("create view v as select a,b from t")
|
||||
# trn1.commit()
|
||||
#
|
||||
# cur1.execute("insert into t values(1,2,3)") # att_12, tra_5
|
||||
# cur1.execute("select * from v")
|
||||
# trn1.commit()
|
||||
#
|
||||
# trn2=att2.trans()
|
||||
# cur2=trn2.cursor()
|
||||
# cur2.execute("select * from v") # att_13, tra_7
|
||||
# trn2.commit()
|
||||
#
|
||||
# cur1.execute("alter view v as select a, b, c from t") # att-12, tra_8
|
||||
# trn1.commit()
|
||||
#
|
||||
# cur2.execute("select * from v") # att_13, tra_9
|
||||
# printData(cur2)
|
||||
#
|
||||
#---
|
||||
|
||||
act_1 = python_act('db_1', substitutions=substitutions_1)
|
||||
|
||||
expected_stdout_1 = """
|
||||
expected_stdout = """
|
||||
A B C
|
||||
1 2 3
|
||||
"""
|
||||
|
||||
@pytest.mark.version('>=2.5.6')
|
||||
def test_1(act_1: Action, capsys):
|
||||
with act_1.db.connect() as att1, act_1.db.connect() as att2:
|
||||
@pytest.mark.version('>=3')
|
||||
def test_1(act: Action, capsys):
|
||||
with act.db.connect() as att1, act.db.connect() as att2:
|
||||
trn1 = att1.transaction_manager()
|
||||
cur1 = trn1.cursor()
|
||||
cur1.execute("create table t(a int, b int, c int)") # att_12, tra_4
|
||||
@ -81,7 +38,7 @@ def test_1(act_1: Action, capsys):
|
||||
cur1.execute("alter view v as select a, b, c from t") # att-12, tra_8
|
||||
trn1.commit()
|
||||
cur2.execute("select * from v") # att_13, tra_9
|
||||
act_1.print_data(cur2)
|
||||
act_1.expected_stdout = expected_stdout_1
|
||||
act_1.stdout = capsys.readouterr().out
|
||||
assert act_1.clean_stdout == act_1.clean_expected_stdout
|
||||
act.print_data(cur2)
|
||||
act.expected_stdout = 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_3029
|
||||
# title: Bugcheck "Too many savepoints (287)" at rollback after exception at EXECUTE BLOCK with exception handler
|
||||
# decription:
|
||||
# tracker_id: CORE-3029
|
||||
# min_versions: ['2.5.1']
|
||||
# versions: 2.5.3
|
||||
# qmid: None
|
||||
|
||||
"""
|
||||
ID: issue-3410
|
||||
ISSUE: 3410
|
||||
TITLE: Bugcheck "Too many savepoints (287)" at rollback after exception at EXECUTE BLOCK with exception handler
|
||||
DESCRIPTION:
|
||||
JIRA: CORE-3029
|
||||
"""
|
||||
|
||||
import pytest
|
||||
from firebird.qa import db_factory, isql_act, Action
|
||||
from firebird.qa import *
|
||||
|
||||
# version: 2.5.3
|
||||
# resources: None
|
||||
|
||||
substitutions_1 = [('line.*', ''), ('col.*', '')]
|
||||
|
||||
init_script_1 = """create sequence test_gen;
|
||||
init_script = """create sequence test_gen;
|
||||
|
||||
recreate table test_row
|
||||
(id int not null,
|
||||
@ -32,9 +27,9 @@ insert into test_row(id, did, pid,dep) values(1, 2, 3, 4);
|
||||
commit;
|
||||
"""
|
||||
|
||||
db_1 = db_factory(page_size=4096, sql_dialect=3, init=init_script_1)
|
||||
db = db_factory(init=init_script)
|
||||
|
||||
test_script_1 = """set term !!;
|
||||
test_script = """set term !!;
|
||||
execute block returns(id int, did int, dep int, pid int)
|
||||
as
|
||||
declare variable xid int;
|
||||
@ -85,20 +80,20 @@ select * from sp_test !!
|
||||
rollback !!
|
||||
"""
|
||||
|
||||
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
|
||||
act = isql_act('db', test_script, substitutions=[('line.*', ''), ('col.*', '')])
|
||||
|
||||
expected_stdout_1 = """Database: localhost:C:\\Users\\win7\\Firebird_tests\\fbt-repository\\tmp\\bugs.core_3029.fdb, User: SYSDBA
|
||||
SQL> SQL> CON> CON> CON> CON> CON> CON> CON> CON> CON> CON> CON> CON> CON> CON> CON> CON> CON> CON> CON> CON> CON>
|
||||
expected_stdout = """
|
||||
ID DID DEP PID
|
||||
============ ============ ============ ============
|
||||
<null> 2 4 3
|
||||
<null> 2 4 3
|
||||
SQL> SQL> CON> CON> CON> CON> CON> CON> CON> CON> CON> CON> CON> CON> CON> CON> CON> CON> CON> CON> CON> CON> CON> CON> SQL>
|
||||
|
||||
ID DID DEP PID
|
||||
============ ============ ============ ============
|
||||
<null> 2 4 3
|
||||
SQL> SQL>"""
|
||||
expected_stderr_1 = """Statement failed, SQLSTATE = 23000
|
||||
"""
|
||||
|
||||
expected_stderr = """Statement failed, SQLSTATE = 23000
|
||||
attempt to store duplicate value (visible to active transactions) in unique index "IX_TEST_ROW1"
|
||||
-Problematic key value is ("DID" = 2, "PID" = 3, "DEP" = 4)
|
||||
-At block
|
||||
@ -110,11 +105,11 @@ attempt to store duplicate value (visible to active transactions) in unique inde
|
||||
-At procedure 'SP_TEST' line: 20, col: 12
|
||||
"""
|
||||
|
||||
@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,26 +1,19 @@
|
||||
#coding:utf-8
|
||||
#
|
||||
# id: bugs.core_3038
|
||||
# title: Wrong resultset
|
||||
# decription: The insert failed because a column definition includes validation constraints. validation error for variable
|
||||
# tracker_id: CORE-3038
|
||||
# min_versions: ['2.5.0']
|
||||
# versions: 2.5
|
||||
# qmid: None
|
||||
|
||||
"""
|
||||
ID: issue-3419
|
||||
ISSUE: 3419
|
||||
TITLE: The insert failed because a column definition includes validation constraints. validation error for variable
|
||||
DESCRIPTION:
|
||||
JIRA: CORE-3038
|
||||
"""
|
||||
|
||||
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 = []
|
||||
|
||||
init_script_1 = """"""
|
||||
|
||||
db_1 = db_factory(charset='UTF8', sql_dialect=3, init=init_script_1)
|
||||
|
||||
test_script_1 = """
|
||||
test_script = """
|
||||
create domain money as numeric(15,4);
|
||||
commit;
|
||||
|
||||
@ -40,13 +33,14 @@ test_script_1 = """
|
||||
commit;
|
||||
|
||||
execute procedure testp(1, 6);
|
||||
commit;
|
||||
commit;
|
||||
"""
|
||||
|
||||
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,22 +1,17 @@
|
||||
#coding:utf-8
|
||||
#
|
||||
# id: bugs.core_3045
|
||||
# title: "conversion error from string" after change of field type from BIGINT to VARCHAR(21)
|
||||
# decription:
|
||||
# tracker_id: CORE-3045
|
||||
# min_versions: ['2.5.0']
|
||||
# versions: 2.5.0
|
||||
# qmid: None
|
||||
|
||||
"""
|
||||
ID: issue-3426
|
||||
ISSUE: 3426
|
||||
TITLE: "conversion error from string" after change of field type from BIGINT to VARCHAR(21)
|
||||
DESCRIPTION:
|
||||
JIRA: CORE-3045
|
||||
"""
|
||||
|
||||
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 TEST1(
|
||||
init_script = """CREATE TABLE TEST1(
|
||||
ID INTEGER,
|
||||
TEST_FIELD BIGINT,
|
||||
|
||||
@ -30,9 +25,9 @@ VALUES(1, 234);
|
||||
|
||||
COMMIT;"""
|
||||
|
||||
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 TEST1
|
||||
test_script = """ALTER TABLE TEST1
|
||||
ALTER TEST_FIELD TYPE VARCHAR(21);
|
||||
|
||||
COMMIT;
|
||||
@ -45,18 +40,18 @@ FROM TEST1
|
||||
WHERE TEST_FIELD != 'A';
|
||||
"""
|
||||
|
||||
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
|
||||
act = isql_act('db', test_script)
|
||||
|
||||
expected_stdout_1 = """
|
||||
expected_stdout = """
|
||||
ID TEST_FIELD
|
||||
============ =====================
|
||||
1 234
|
||||
|
||||
"""
|
||||
|
||||
@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.0')
|
||||
def test_1(act: Action):
|
||||
act.expected_stdout = expected_stdout
|
||||
act.execute()
|
||||
assert act.clean_stdout == act.clean_expected_stdout
|
||||
|
||||
|
@ -1,38 +1,21 @@
|
||||
#coding:utf-8
|
||||
#
|
||||
# id: bugs.core_3047
|
||||
# title: Wrong logic is used to resolve EXECUTE BLOCK parameters collations
|
||||
# decription:
|
||||
# tracker_id: CORE-3047
|
||||
# min_versions: ['3.0']
|
||||
# versions: 3.0
|
||||
# qmid: None
|
||||
|
||||
"""
|
||||
ID: issue-3428
|
||||
ISSUE: 3428
|
||||
TITLE: Wrong logic is used to resolve EXECUTE BLOCK parameters collations
|
||||
DESCRIPTION:
|
||||
JIRA: CORE-3047
|
||||
"""
|
||||
|
||||
import pytest
|
||||
from firebird.qa import db_factory, isql_act, Action
|
||||
from firebird.qa import *
|
||||
|
||||
# version: 3.0
|
||||
# resources: None
|
||||
db = db_factory(charset='UTF8')
|
||||
|
||||
substitutions_1 = []
|
||||
|
||||
init_script_1 = """"""
|
||||
|
||||
db_1 = db_factory(page_size=4096, charset='UTF8', sql_dialect=3, init=init_script_1)
|
||||
|
||||
test_script_1 = """
|
||||
-- In 2.5 (checked on WI-V2.5.5.26861):
|
||||
-- Statement failed, SQLSTATE = HY004
|
||||
-- Dynamic SQL Error
|
||||
-- -SQL error code = -204
|
||||
-- -Data type unknown
|
||||
-- -COLLATION WIN_PTBR for CHARACTER SET UTF8 is not defined
|
||||
-- (See ticket issue: "WIN_PTBR is tried to be resolved agains database charset instead of client charset: incorrect")
|
||||
-- In 3.0.0.31827 (WI- and LI-) works fine:
|
||||
-- [pcisar] 20.10.2021
|
||||
-- It fails as well in 3.0.7 and 4.0 on Linux (opensuse tumbleweed) and Windows (8.1)
|
||||
-- It appears that this test is bogus from the beginning
|
||||
test_script = """
|
||||
set term ^;
|
||||
-- win_ptbr should be resolved against connection charset (win1252), not database (utf8)
|
||||
execute block returns (c varchar(10) collate win_ptbr) as
|
||||
begin
|
||||
end
|
||||
@ -40,11 +23,11 @@ test_script_1 = """
|
||||
set term ;^
|
||||
"""
|
||||
|
||||
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
|
||||
|
||||
act = isql_act('db', test_script)
|
||||
|
||||
@pytest.mark.version('>=3.0')
|
||||
def test_1(act_1: Action):
|
||||
pytest.xfail("Either not fixed or wrong test")
|
||||
act_1.execute()
|
||||
|
||||
def test_1(act: Action):
|
||||
try:
|
||||
act.execute(charset='win1252')
|
||||
except ExecutionError as e:
|
||||
pytest.fail("Test script execution failed", pytrace=False)
|
||||
|
@ -1,26 +1,20 @@
|
||||
#coding:utf-8
|
||||
#
|
||||
# id: bugs.core_3052
|
||||
# title: Wrong resultset
|
||||
# decription: Empty rowset when selecting from table with compound index on PXW_HUNDC-collated fields
|
||||
# tracker_id: CORE-3052
|
||||
# min_versions: ['3.0']
|
||||
# versions: 3.0
|
||||
# qmid: None
|
||||
|
||||
"""
|
||||
ID: issue-3432
|
||||
ISSUE: 3432
|
||||
TITLE: Wrong resultset
|
||||
DESCRIPTION:
|
||||
Empty rowset when selecting from table with compound index on PXW_HUNDC-collated fields
|
||||
JIRA: CORE-3052
|
||||
"""
|
||||
|
||||
import pytest
|
||||
from firebird.qa import db_factory, isql_act, Action
|
||||
from firebird.qa import *
|
||||
|
||||
# version: 3.0
|
||||
# resources: None
|
||||
db = db_factory(charset='WIN1250')
|
||||
|
||||
substitutions_1 = []
|
||||
|
||||
init_script_1 = """"""
|
||||
|
||||
db_1 = db_factory(charset='WIN1250', sql_dialect=3, init=init_script_1)
|
||||
|
||||
test_script_1 = """
|
||||
test_script = """
|
||||
-- NB: do NOT downgrate minimal version to 2.5 - at least for 2.5.4.26857
|
||||
-- following queries return zero rows.
|
||||
|
||||
@ -53,9 +47,9 @@ test_script_1 = """
|
||||
where te.m1 = 'A' and te.m2 like 'D%';
|
||||
"""
|
||||
|
||||
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
|
||||
act = isql_act('db', test_script)
|
||||
|
||||
expected_stdout_1 = """
|
||||
expected_stdout = """
|
||||
M1 A
|
||||
M2 C1
|
||||
VAL 1
|
||||
@ -70,8 +64,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_3055
|
||||
# title: Variable/argument name could be absent or be wrong in error messages when more than 256 variables are used
|
||||
# decription:
|
||||
# tracker_id: CORE-3055
|
||||
# min_versions: ['3.0']
|
||||
# versions: 3.0
|
||||
# qmid: None
|
||||
|
||||
"""
|
||||
ID: issue-3435
|
||||
ISSUE: 3435
|
||||
TITLE: Variable/argument name could be absent or be wrong in error messages when more than 256 variables are used
|
||||
DESCRIPTION:
|
||||
JIRA: CORE-3055
|
||||
"""
|
||||
|
||||
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 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 = """
|
||||
create domain dm_nn int not null;
|
||||
commit;
|
||||
set term ^;
|
||||
@ -2030,23 +2023,23 @@ test_script_1 = """
|
||||
v_nn = null;
|
||||
end
|
||||
^ set term ;^
|
||||
-- ::: NB:::
|
||||
-- ::: NB:::
|
||||
-- *** All *** versions of 2.5 will produce here the NUMBER of variable rather than its name:
|
||||
-- validation error for variable number 2001, value "*** null ***"
|
||||
-- (though "Affected version/s 2.1.3, 3.0 Initial, 2.5 RC1, 2.5 RC2")
|
||||
"""
|
||||
|
||||
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 = 42000
|
||||
validation error for variable V_NN, value "*** null ***"
|
||||
-At block line: 2004, col: 9
|
||||
"""
|
||||
|
||||
@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,31 +1,24 @@
|
||||
#coding:utf-8
|
||||
#
|
||||
# id: bugs.core_3056
|
||||
# title: Problems may happen when issuing DDL commands in the same transaction after CREATE COLLATION was issued
|
||||
# decription:
|
||||
# tracker_id: CORE-3056
|
||||
# min_versions: ['3.0']
|
||||
# versions: 3.0
|
||||
# qmid: None
|
||||
|
||||
"""
|
||||
ID: issue-3436
|
||||
ISSUE: 3436
|
||||
TITLE: Problems may happen when issuing DDL commands in the same transaction after CREATE COLLATION was issued
|
||||
DESCRIPTION:
|
||||
JIRA: CORE-3056
|
||||
"""
|
||||
|
||||
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 = """
|
||||
-- NOTES.
|
||||
-- 1. Results are identical on: LI-T3.0.0.31827 (64 bit) and WI-T3.0.0.31827 (32 bit).
|
||||
-- 2. Despite of ticket issue that it was fixed only in 3.0, following script works OK on also oon 2.5
|
||||
-- (tested on WI-V2.5.5.26861; differences are only in stderr).
|
||||
-- 3. ## TODO ###
|
||||
-- 3. ## TODO ###
|
||||
-- Uncomment lines "--,constraint test_pk1 primary key" after CORE-4783 will be fixed, and add
|
||||
-- statement 'alter table drop constraint <PK>" before each DROP TABLE statements.
|
||||
|
||||
@ -40,8 +33,8 @@ test_script_1 = """
|
||||
join rdb$character_sets cs on ff.rdb$character_set_id = cs.rdb$character_set_id
|
||||
where rf.rdb$relation_name = 'TEST'
|
||||
order by rf.rdb$field_position;
|
||||
|
||||
/*
|
||||
|
||||
/*
|
||||
-- This works only in 3.0 and does NOT in 2.5 (rdb$collation_id present there only in rdb$relation_fields and NOT in rdb$fields):
|
||||
create or alter view v_test_fields_ddl as
|
||||
select rf.rdb$field_name fld_name, cs.rdb$character_set_name cset_name, co.rdb$base_collation_name base_coll, co.rdb$collation_attributes
|
||||
@ -52,7 +45,7 @@ test_script_1 = """
|
||||
where rf.rdb$relation_name = 'TEST'
|
||||
order by rf.rdb$field_position;
|
||||
*/
|
||||
|
||||
|
||||
recreate table test(id int);
|
||||
commit;
|
||||
set term ^;
|
||||
@ -77,12 +70,12 @@ test_script_1 = """
|
||||
^
|
||||
set term ;^
|
||||
drop table test;
|
||||
|
||||
|
||||
set autoddl off; -- ######### NOTE: all statements below will be run in the same Tx #########
|
||||
commit;
|
||||
|
||||
|
||||
set list on;
|
||||
|
||||
|
||||
-- This is sample from ticket:
|
||||
create collation coll_01 for utf8 from unicode no pad;
|
||||
--commit; -- (1)
|
||||
@ -100,13 +93,13 @@ test_script_1 = """
|
||||
|
||||
-- `select * from v_test_fields_ddl;`: must return 0 rows
|
||||
set echo on;
|
||||
select * from v_test_fields_ddl;
|
||||
select * from v_test_fields_ddl;
|
||||
drop collation coll_01;
|
||||
set echo off;
|
||||
set count off;
|
||||
|
||||
|
||||
-- All the following statements should NOT fail:
|
||||
|
||||
|
||||
create collation coll_01 for win1251 from pxw_cyrl pad space case insensitive accent insensitive;
|
||||
create collation coll_02 for win1251 from pxw_cyrl pad space case insensitive accent insensitive;
|
||||
create collation coll_03 for win1251 from pxw_cyrl pad space case insensitive accent insensitive;
|
||||
@ -119,7 +112,7 @@ test_script_1 = """
|
||||
create collation coll_10 for win1251 from pxw_cyrl pad space case insensitive accent insensitive;
|
||||
create collation coll_11 for win1251 from pxw_cyrl pad space case insensitive accent insensitive;
|
||||
create collation coll_12 for win1251 from pxw_cyrl pad space case insensitive accent insensitive;
|
||||
|
||||
|
||||
create table test(
|
||||
f01 varchar(2) character set win1251 collate coll_01
|
||||
,f02 varchar(2) character set win1251 collate coll_02
|
||||
@ -135,11 +128,11 @@ test_script_1 = """
|
||||
,f12 varchar(2) character set win1251 collate coll_12
|
||||
--,constraint test_pk1 primary key (f01, f02, f03, f04, f05, f06, f07, f08, f09, f10, f11, f12)
|
||||
);
|
||||
|
||||
|
||||
select * from v_test_fields_ddl;
|
||||
|
||||
|
||||
drop table test;
|
||||
|
||||
|
||||
drop collation coll_01;
|
||||
drop collation coll_02;
|
||||
drop collation coll_03;
|
||||
@ -152,7 +145,7 @@ test_script_1 = """
|
||||
drop collation coll_10;
|
||||
drop collation coll_11;
|
||||
drop collation coll_12;
|
||||
|
||||
|
||||
create collation coll_01 for utf8 from unicode no pad;
|
||||
create collation coll_02 for utf8 from unicode no pad;
|
||||
create collation coll_03 for utf8 from unicode no pad;
|
||||
@ -165,7 +158,7 @@ test_script_1 = """
|
||||
create collation coll_10 for utf8 from unicode no pad;
|
||||
create collation coll_11 for utf8 from unicode no pad;
|
||||
create collation coll_12 for utf8 from unicode no pad;
|
||||
|
||||
|
||||
create table test(
|
||||
f01 varchar(2) character set utf8 collate coll_01
|
||||
,f02 varchar(2) character set utf8 collate coll_02
|
||||
@ -181,10 +174,10 @@ test_script_1 = """
|
||||
,f12 varchar(2) character set utf8 collate coll_12
|
||||
--,constraint test_pk2 primary key (f01, f02, f03, f04, f05, f06, f07, f08, f09, f10, f11, f12)
|
||||
);
|
||||
|
||||
|
||||
select * from v_test_fields_ddl;
|
||||
drop table test;
|
||||
|
||||
|
||||
drop collation coll_01;
|
||||
drop collation coll_02;
|
||||
drop collation coll_03;
|
||||
@ -197,7 +190,7 @@ test_script_1 = """
|
||||
drop collation coll_10;
|
||||
drop collation coll_11;
|
||||
drop collation coll_12;
|
||||
|
||||
|
||||
-- this was tested both on windows ans linux, should be created OK
|
||||
-- (all these collations are declared in the file 'fbintl.conf'):
|
||||
create collation coll_01 for iso8859_1 from external ('DA_DA');
|
||||
@ -212,7 +205,7 @@ test_script_1 = """
|
||||
create collation coll_10 for iso8859_1 from external ('FR_FR');
|
||||
create collation coll_11 for iso8859_1 from external ('IS_IS');
|
||||
create collation coll_12 for iso8859_1 from external ('IT_IT');
|
||||
|
||||
|
||||
create table test(
|
||||
f01 varchar(2) character set iso8859_1 collate coll_01
|
||||
,f02 varchar(2) character set iso8859_1 collate coll_02
|
||||
@ -228,10 +221,10 @@ test_script_1 = """
|
||||
,f12 varchar(2) character set iso8859_1 collate coll_12
|
||||
--,constraint test_pk2 primary key (f01, f02, f03, f04, f05, f06, f07, f08, f09, f10, f11, f12)
|
||||
);
|
||||
|
||||
|
||||
select * from v_test_fields_ddl;
|
||||
--select current_transaction from rdb$database;
|
||||
|
||||
|
||||
rollback;
|
||||
set count on;
|
||||
-- Both selects below must return 0 rows:
|
||||
@ -240,169 +233,170 @@ test_script_1 = """
|
||||
select * from rdb$collations co where co.rdb$collation_name starting with 'COLL_';
|
||||
"""
|
||||
|
||||
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
|
||||
act = isql_act('db', test_script)
|
||||
|
||||
expected_stdout_1 = """
|
||||
expected_stdout = """
|
||||
select * from v_test_fields_ddl;
|
||||
Records affected: 0
|
||||
drop collation coll_01;
|
||||
set echo off;
|
||||
|
||||
|
||||
FLD_NAME F01
|
||||
CSET_NAME WIN1251
|
||||
BASE_COLL PXW_CYRL
|
||||
|
||||
|
||||
FLD_NAME F02
|
||||
CSET_NAME WIN1251
|
||||
BASE_COLL PXW_CYRL
|
||||
|
||||
|
||||
FLD_NAME F03
|
||||
CSET_NAME WIN1251
|
||||
BASE_COLL PXW_CYRL
|
||||
|
||||
|
||||
FLD_NAME F04
|
||||
CSET_NAME WIN1251
|
||||
BASE_COLL PXW_CYRL
|
||||
|
||||
|
||||
FLD_NAME F05
|
||||
CSET_NAME WIN1251
|
||||
BASE_COLL PXW_CYRL
|
||||
|
||||
|
||||
FLD_NAME F06
|
||||
CSET_NAME WIN1251
|
||||
BASE_COLL PXW_CYRL
|
||||
|
||||
|
||||
FLD_NAME F07
|
||||
CSET_NAME WIN1251
|
||||
BASE_COLL PXW_CYRL
|
||||
|
||||
|
||||
FLD_NAME F08
|
||||
CSET_NAME WIN1251
|
||||
BASE_COLL PXW_CYRL
|
||||
|
||||
|
||||
FLD_NAME F09
|
||||
CSET_NAME WIN1251
|
||||
BASE_COLL PXW_CYRL
|
||||
|
||||
|
||||
FLD_NAME F10
|
||||
CSET_NAME WIN1251
|
||||
BASE_COLL PXW_CYRL
|
||||
|
||||
|
||||
FLD_NAME F11
|
||||
CSET_NAME WIN1251
|
||||
BASE_COLL PXW_CYRL
|
||||
|
||||
|
||||
FLD_NAME F12
|
||||
CSET_NAME WIN1251
|
||||
BASE_COLL PXW_CYRL
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
FLD_NAME F01
|
||||
CSET_NAME UTF8
|
||||
BASE_COLL UNICODE
|
||||
|
||||
|
||||
FLD_NAME F02
|
||||
CSET_NAME UTF8
|
||||
BASE_COLL UNICODE
|
||||
|
||||
|
||||
FLD_NAME F03
|
||||
CSET_NAME UTF8
|
||||
BASE_COLL UNICODE
|
||||
|
||||
|
||||
FLD_NAME F04
|
||||
CSET_NAME UTF8
|
||||
BASE_COLL UNICODE
|
||||
|
||||
|
||||
FLD_NAME F05
|
||||
CSET_NAME UTF8
|
||||
BASE_COLL UNICODE
|
||||
|
||||
|
||||
FLD_NAME F06
|
||||
CSET_NAME UTF8
|
||||
BASE_COLL UNICODE
|
||||
|
||||
|
||||
FLD_NAME F07
|
||||
CSET_NAME UTF8
|
||||
BASE_COLL UNICODE
|
||||
|
||||
|
||||
FLD_NAME F08
|
||||
CSET_NAME UTF8
|
||||
BASE_COLL UNICODE
|
||||
|
||||
|
||||
FLD_NAME F09
|
||||
CSET_NAME UTF8
|
||||
BASE_COLL UNICODE
|
||||
|
||||
|
||||
FLD_NAME F10
|
||||
CSET_NAME UTF8
|
||||
BASE_COLL UNICODE
|
||||
|
||||
|
||||
FLD_NAME F11
|
||||
CSET_NAME UTF8
|
||||
BASE_COLL UNICODE
|
||||
|
||||
|
||||
FLD_NAME F12
|
||||
CSET_NAME UTF8
|
||||
BASE_COLL UNICODE
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
FLD_NAME F01
|
||||
CSET_NAME ISO8859_1
|
||||
BASE_COLL DA_DA
|
||||
|
||||
|
||||
FLD_NAME F02
|
||||
CSET_NAME ISO8859_1
|
||||
BASE_COLL DE_DE
|
||||
|
||||
|
||||
FLD_NAME F03
|
||||
CSET_NAME ISO8859_1
|
||||
BASE_COLL DU_NL
|
||||
|
||||
|
||||
FLD_NAME F04
|
||||
CSET_NAME ISO8859_1
|
||||
BASE_COLL EN_UK
|
||||
|
||||
|
||||
FLD_NAME F05
|
||||
CSET_NAME ISO8859_1
|
||||
BASE_COLL EN_US
|
||||
|
||||
|
||||
FLD_NAME F06
|
||||
CSET_NAME ISO8859_1
|
||||
BASE_COLL ES_ES
|
||||
|
||||
|
||||
FLD_NAME F07
|
||||
CSET_NAME ISO8859_1
|
||||
BASE_COLL ES_ES_CI_AI
|
||||
|
||||
|
||||
FLD_NAME F08
|
||||
CSET_NAME ISO8859_1
|
||||
BASE_COLL FI_FI
|
||||
|
||||
|
||||
FLD_NAME F09
|
||||
CSET_NAME ISO8859_1
|
||||
BASE_COLL FR_CA
|
||||
|
||||
|
||||
FLD_NAME F10
|
||||
CSET_NAME ISO8859_1
|
||||
BASE_COLL FR_FR
|
||||
|
||||
|
||||
FLD_NAME F11
|
||||
CSET_NAME ISO8859_1
|
||||
BASE_COLL IS_IS
|
||||
|
||||
|
||||
FLD_NAME F12
|
||||
CSET_NAME ISO8859_1
|
||||
BASE_COLL IT_IT
|
||||
|
||||
|
||||
|
||||
|
||||
select * from v_test_fields_ddl;
|
||||
Records affected: 0
|
||||
select * from rdb$collations co where co.rdb$collation_name starting with 'COLL_';
|
||||
Records affected: 0
|
||||
"""
|
||||
expected_stderr_1 = """
|
||||
|
||||
expected_stderr = """
|
||||
Statement failed, SQLSTATE = 22021
|
||||
unsuccessful metadata update
|
||||
-CREATE TABLE TEST failed
|
||||
@ -412,10 +406,10 @@ expected_stderr_1 = """
|
||||
"""
|
||||
|
||||
@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_stderr == act_1.clean_expected_stderr
|
||||
assert act_1.clean_stdout == act_1.clean_expected_stdout
|
||||
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,33 +1,26 @@
|
||||
#coding:utf-8
|
||||
#
|
||||
# id: bugs.core_3057
|
||||
# title: Allow the usage of blobs in COMPUTED BY expressions
|
||||
# decription:
|
||||
# tracker_id: CORE-3057
|
||||
# min_versions: ['3.0']
|
||||
# versions: 3.0
|
||||
# qmid: None
|
||||
|
||||
"""
|
||||
ID: issue-3437
|
||||
ISSUE: 3437
|
||||
TITLE: Allow the usage of blobs in COMPUTED BY expressions
|
||||
DESCRIPTION:
|
||||
JIRA: CORE-3057
|
||||
"""
|
||||
|
||||
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 = [('BLOB_ID_.*', '')]
|
||||
|
||||
init_script_1 = """"""
|
||||
|
||||
db_1 = db_factory(sql_dialect=3, init=init_script_1)
|
||||
|
||||
test_script_1 = """
|
||||
recreate table test(
|
||||
b1 blob sub_type 1 character set utf8 collate unicode_ci_ai,
|
||||
b2 blob sub_type 1 character set utf8 collate unicode_ci_ai,
|
||||
test_script = """
|
||||
recreate table test(
|
||||
b1 blob sub_type 1 character set utf8 collate unicode_ci_ai,
|
||||
b2 blob sub_type 1 character set utf8 collate unicode_ci_ai,
|
||||
bconcat1 computed by ( b1 || b2 ) -- this FAILS on 2.5.4
|
||||
);
|
||||
);
|
||||
commit;
|
||||
alter table test
|
||||
alter table test
|
||||
add bconcat2 computed by ( b1 || b2 || bconcat1 )
|
||||
,add brepl1_2 computed by ( replace(b1, b2, '1') )
|
||||
,add brepl2_1 computed by ( replace(b2, b1, '2') )
|
||||
@ -38,13 +31,13 @@ test_script_1 = """
|
||||
'ÁÉÍÓÚÝÀÈÌÒÙÂÊÎÔÛÃÑÕÄËÏÖÜŸÇŠĄĘŹŻĂŞŢ',
|
||||
'aeiouyaeiouaeiouanoaeiouycsaezzast'
|
||||
);
|
||||
|
||||
|
||||
set list on;
|
||||
set blob all;
|
||||
select
|
||||
b1 as blob_id_b1,
|
||||
b2 as blob_id_b2,
|
||||
bconcat1 as blob_id_bconcat1,
|
||||
select
|
||||
b1 as blob_id_b1,
|
||||
b2 as blob_id_b2,
|
||||
bconcat1 as blob_id_bconcat1,
|
||||
bconcat2 as blob_id_bconcat2,
|
||||
brepl1_2 as blob_id_repl1_2,
|
||||
brepl2_1 as blob_id_repl2_1
|
||||
@ -52,9 +45,9 @@ test_script_1 = """
|
||||
;
|
||||
"""
|
||||
|
||||
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
|
||||
act = isql_act('db', test_script, substitutions=[('BLOB_ID_.*', 'BLOB_ID')])
|
||||
|
||||
expected_stdout_1 = """
|
||||
expected_stdout = """
|
||||
BLOB_ID_B1 86:0
|
||||
ÁÉÍÓÚÝÀÈÌÒÙÂÊÎÔÛÃÑÕÄËÏÖÜŸÇŠĄĘŹŻĂŞŢ
|
||||
BLOB_ID_B2 86:1
|
||||
@ -70,8 +63,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,81 +1,73 @@
|
||||
#coding:utf-8
|
||||
#
|
||||
# id: bugs.core_3058
|
||||
# title: New generators are created with wrong value when more than 32K generators was previously created
|
||||
# decription:
|
||||
# New URL: https://github.com/FirebirdSQL/firebird/issues/3438
|
||||
#
|
||||
# Re-implemented in order to generate SQL script with more than 32K create / get gen_id / drop sequences.
|
||||
# Total number of created sequences is set by 'TOTAL_SEQUENCES_COUNT' variable.
|
||||
#
|
||||
# uses LOCAL connection protocol
|
||||
# In order to reduce time:
|
||||
# * FW is changed OFF
|
||||
# * test uses LOCAL connection protocol
|
||||
# Confirmed bug on 2.5.0.26074:
|
||||
# sequence 'g_1' that is created after <TOTAL_SEQUENCES_COUNT> iterations
|
||||
# has current value = 59049 (instead of expected 0).
|
||||
# Checked on:
|
||||
# 5.0.0.43 SS: 78.226s.
|
||||
# 5.0.0.40 CS: 79.564s.
|
||||
# 4.0.0.2491 SS: 78.766s.
|
||||
# 4.0.0.2489 CS: 79.419s.
|
||||
# 3.0.8.33468 SS: 76.687s.
|
||||
# 3.0.8.33452 CS: 84.176s.
|
||||
# 2.5.9.27152 SC: 116.247s.
|
||||
#
|
||||
# tracker_id: CORE-3058
|
||||
# min_versions: ['2.5.1']
|
||||
# versions: 2.5.1
|
||||
# qmid:
|
||||
|
||||
"""
|
||||
ID: issue-3438
|
||||
ISSUE: 3438
|
||||
TITLE: New generators are created with wrong value when more than 32K generators was previously created
|
||||
DESCRIPTION:
|
||||
Confirmed bug on 2.5.0.26074:
|
||||
sequence 'g_1' that is created after <TOTAL_SEQUENCES_COUNT> iterations
|
||||
has current value = 59049 (instead of expected 0).
|
||||
NOTES:
|
||||
Re-implemented in order to generate SQL script with more than 32K create / get gen_id / drop sequences.
|
||||
Total number of created sequences is set by 'TOTAL_SEQUENCES_COUNT' variable.
|
||||
JIRA: CORE-3058
|
||||
"""
|
||||
|
||||
import pytest
|
||||
from firebird.qa import db_factory, python_act, Action
|
||||
from firebird.qa import *
|
||||
|
||||
# version: 2.5.1
|
||||
# resources: None
|
||||
db = db_factory()
|
||||
|
||||
substitutions_1 = []
|
||||
act = python_act('db')
|
||||
|
||||
init_script_1 = """"""
|
||||
expected_stdout_1 = """
|
||||
MON$FORCED_WRITES 0
|
||||
GEN_ID 0
|
||||
"""
|
||||
|
||||
db_1 = db_factory(sql_dialect=3, init=init_script_1)
|
||||
TOTAL_SEQUENCES_COUNT = 33000
|
||||
|
||||
@pytest.mark.version('>=3')
|
||||
@pytest.mark.xfail
|
||||
def test_1(act: Action):
|
||||
pytest.fail("Test not IMPLEMENTED")
|
||||
|
||||
# test_script_1
|
||||
#---
|
||||
#
|
||||
#
|
||||
#
|
||||
#
|
||||
# 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_SEQUENCES_COUNT=33000
|
||||
# ###########################
|
||||
#
|
||||
#
|
||||
# #--------------------------------------------
|
||||
#
|
||||
#
|
||||
# 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 )):
|
||||
@ -86,20 +78,20 @@ 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;
|
||||
# select mon$forced_writes from mon$database;
|
||||
# set term #;
|
||||
# '''
|
||||
#
|
||||
#
|
||||
# for i in range(1,TOTAL_SEQUENCES_COUNT+1):
|
||||
# script = '\\n'.join(
|
||||
# ( script
|
||||
@ -108,7 +100,7 @@ db_1 = db_factory(sql_dialect=3, init=init_script_1)
|
||||
# ,'drop sequence g_%d#' % i
|
||||
# )
|
||||
# )
|
||||
#
|
||||
#
|
||||
# script = '\\n'.join(
|
||||
# ( script
|
||||
# ,'set term ;#'
|
||||
@ -117,46 +109,34 @@ db_1 = db_factory(sql_dialect=3, init=init_script_1)
|
||||
# ,'select gen_id(g_1,0) from rdb$database;'
|
||||
# )
|
||||
# )
|
||||
#
|
||||
#
|
||||
#
|
||||
#
|
||||
# f_isql_cmd=open(os.path.join(context['temp_directory'],'tmp_core_3058.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_3058.log'),'w')
|
||||
# f_isql_err=open(os.path.join(context['temp_directory'],'tmp_core_3058.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)
|
||||
|
||||
expected_stdout_1 = """
|
||||
MON$FORCED_WRITES 0
|
||||
GEN_ID 0
|
||||
"""
|
||||
|
||||
@pytest.mark.version('>=2.5.1')
|
||||
@pytest.mark.xfail
|
||||
def test_1(act_1: Action):
|
||||
pytest.fail("Test not IMPLEMENTED")
|
||||
|
@ -1,22 +1,17 @@
|
||||
#coding:utf-8
|
||||
#
|
||||
# id: bugs.core_3064
|
||||
# title: Using both the procedure name and alias inside an explicit plan crashes the server
|
||||
# decription:
|
||||
# tracker_id: CORE-3064
|
||||
# min_versions: ['2.5.1']
|
||||
# versions: 2.5.1
|
||||
# qmid: None
|
||||
|
||||
"""
|
||||
ID: issue-3443
|
||||
ISSUE: 3443
|
||||
TITLE: Using both the procedure name and alias inside an explicit plan crashes the server
|
||||
DESCRIPTION:
|
||||
JIRA: CORE-3064
|
||||
"""
|
||||
|
||||
import pytest
|
||||
from firebird.qa import db_factory, isql_act, Action
|
||||
from firebird.qa import *
|
||||
|
||||
# version: 2.5.1
|
||||
# resources: None
|
||||
|
||||
substitutions_1 = [('offset .*', '')]
|
||||
|
||||
init_script_1 = """
|
||||
init_script = """
|
||||
set term ^ ;
|
||||
create or alter procedure get_dates (
|
||||
adate_from date,
|
||||
@ -38,17 +33,17 @@ 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 planonly;
|
||||
select * from get_dates( 'yesterday', 'today' ) PLAN (GET_DATES NATURAL);
|
||||
select * from get_dates( 'yesterday', 'today' ) p PLAN (P NATURAL);
|
||||
"""
|
||||
|
||||
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
|
||||
act = isql_act('db', test_script, substitutions=[('offset .*', 'offset')])
|
||||
|
||||
expected_stderr_1 = """
|
||||
expected_stderr = """
|
||||
Statement failed, SQLSTATE = 42S02
|
||||
Dynamic SQL Error
|
||||
-SQL error code = -104
|
||||
@ -59,9 +54,9 @@ invalid request BLR at offset 50
|
||||
-BLR syntax error: expected TABLE at offset 51, encountered 132
|
||||
"""
|
||||
|
||||
@pytest.mark.version('>=2.5.1')
|
||||
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,29 +1,19 @@
|
||||
#coding:utf-8
|
||||
#
|
||||
# id: bugs.core_3073
|
||||
# title: Foreign key cascade with SET DEFAULT uses the default value of the moment of the FK creation
|
||||
# decription:
|
||||
# Confirmed bug on WI-T4.0.0.503.
|
||||
# Checked on WI-T4.0.0.511 - works fine.
|
||||
#
|
||||
# tracker_id: CORE-3073
|
||||
# min_versions: ['4.0']
|
||||
# versions: 4.0
|
||||
# qmid: None
|
||||
|
||||
"""
|
||||
ID: issue-3452
|
||||
ISSUE: 3452
|
||||
TITLE: Foreign key cascade with SET DEFAULT uses the default value of the moment of the FK creation
|
||||
DESCRIPTION:
|
||||
JIRA: CORE-3073
|
||||
"""
|
||||
|
||||
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 = """
|
||||
recreate table tdetl(x int);
|
||||
recreate table tmain(x int);
|
||||
commit;
|
||||
@ -61,9 +51,9 @@ test_script_1 = """
|
||||
select 'after cascade on tdetl' as msg, d.* from tdetl d;
|
||||
"""
|
||||
|
||||
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
|
||||
act = isql_act('db', test_script)
|
||||
|
||||
expected_stdout_1 = """
|
||||
expected_stdout = """
|
||||
MSG before cascade on tdetl
|
||||
NAME London
|
||||
MSG before cascade on tdetl
|
||||
@ -76,8 +66,8 @@ expected_stdout_1 = """
|
||||
"""
|
||||
|
||||
@pytest.mark.version('>=4.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,94 +1,81 @@
|
||||
#coding:utf-8
|
||||
#
|
||||
# id: bugs.core_3076
|
||||
# title: Better performance for (table.field = :param or :param = -1) in where clause
|
||||
# decription:
|
||||
# Test adds 20'000 rows into a table with single field and two indices on it (asc & desc).
|
||||
# Indexed field will have values which will produce very poor selectivity (~1/3).
|
||||
# Then we check number of indexed and natural reads using mon$ tables and prepared view
|
||||
# from .fbk.
|
||||
# We check cases when SP count rows using equality (=), IN and BETWEEN expr.
|
||||
# When we pass NULLs then procedure should produce zero or low value (<100) of indexed reads.
|
||||
# When we pass not null value then SP should produce IR with number ~ 1/3 of total rows in the table.
|
||||
#
|
||||
# FB30SS, build 3.0.4.32972: OK, 2.734s.
|
||||
# FB40SS, build 4.0.0.977: OK, 3.234s.
|
||||
#
|
||||
# 15.05.2018. TODO LATER, using Python:
|
||||
#
|
||||
# Alternate code for possible checking (use trace with and ensure that only IR will occur when input arg is not null):
|
||||
#
|
||||
# set term ^;
|
||||
# execute block as
|
||||
# begin
|
||||
# begin execute statement 'drop sequence g'; when any do begin end end
|
||||
# end
|
||||
# ^
|
||||
# set term ;^
|
||||
# commit;
|
||||
# create sequence g;
|
||||
# commit;
|
||||
#
|
||||
# create or alter procedure sp_test as begin end;
|
||||
# commit;
|
||||
# recreate table test(x int, y int);
|
||||
# commit;
|
||||
#
|
||||
# insert into test select mod( gen_id(g,1), 123), mod( gen_id(g,1), 321) from rdb$types,rdb$types rows 10000;
|
||||
# commit;
|
||||
#
|
||||
# create index test_x on test(x);
|
||||
# create index test_x_plus_y_asc on test computed by ( x - y );
|
||||
# create descending index test_x_plus_y_dec on test computed by ( x+y );
|
||||
# commit;
|
||||
#
|
||||
# set term ^;
|
||||
# create or alter procedure sp_test( i1 int default null, i2 int default null ) as
|
||||
# declare n int;
|
||||
# declare s_x varchar(1000);
|
||||
# declare s_y varchar(1000);
|
||||
# begin
|
||||
# s_x = 'select count(*) from test where x = :input_arg or :input_arg is null';
|
||||
# s_y = 'select count(*) from test where x + y <= :input_sum and x - y >= :input_arg or :input_sum is null';
|
||||
# execute statement (s_x) ( input_arg := :i1 ) into n;
|
||||
# execute statement (s_y) ( input_arg := :i1, input_sum := :i2 ) into n;
|
||||
# end
|
||||
# ^
|
||||
# set term ;^
|
||||
# commit;
|
||||
#
|
||||
# execute procedure sp_test( 65, 99 );
|
||||
#
|
||||
# Trace log should contain following statistics for two ES:
|
||||
#
|
||||
# Table Natural Index
|
||||
# *****************************************************
|
||||
# TEST 82
|
||||
#
|
||||
# Table Natural Index
|
||||
# *****************************************************
|
||||
# TEST 90
|
||||
#
|
||||
#
|
||||
#
|
||||
# tracker_id: CORE-3076
|
||||
# min_versions: ['3.0']
|
||||
# versions: 3.0
|
||||
# qmid: None
|
||||
|
||||
"""
|
||||
ID: issue-3455
|
||||
ISSUE: 3455
|
||||
TITLE: Better performance for (table.field = :param or :param = -1) in where clause
|
||||
DESCRIPTION:
|
||||
Test adds 20'000 rows into a table with single field and two indices on it (asc & desc).
|
||||
Indexed field will have values which will produce very poor selectivity (~1/3).
|
||||
Then we check number of indexed and natural reads using mon$ tables and prepared view
|
||||
from .fbk.
|
||||
We check cases when SP count rows using equality (=), IN and BETWEEN expr.
|
||||
When we pass NULLs then procedure should produce zero or low value (<100) of indexed reads.
|
||||
When we pass not null value then SP should produce IR with number ~ 1/3 of total rows in the table.
|
||||
NOTES:
|
||||
[15.05.2018]
|
||||
TODO LATER, using Python:
|
||||
Alternate code for possible checking (use trace with and ensure that only IR will occur when input arg is not null):
|
||||
|
||||
set term ^;
|
||||
execute block as
|
||||
begin
|
||||
begin execute statement 'drop sequence g'; when any do begin end end
|
||||
end
|
||||
^
|
||||
set term ;^
|
||||
commit;
|
||||
create sequence g;
|
||||
commit;
|
||||
|
||||
create or alter procedure sp_test as begin end;
|
||||
commit;
|
||||
recreate table test(x int, y int);
|
||||
commit;
|
||||
|
||||
insert into test select mod( gen_id(g,1), 123), mod( gen_id(g,1), 321) from rdb$types,rdb$types rows 10000;
|
||||
commit;
|
||||
|
||||
create index test_x on test(x);
|
||||
create index test_x_plus_y_asc on test computed by ( x - y );
|
||||
create descending index test_x_plus_y_dec on test computed by ( x+y );
|
||||
commit;
|
||||
|
||||
set term ^;
|
||||
create or alter procedure sp_test( i1 int default null, i2 int default null ) as
|
||||
declare n int;
|
||||
declare s_x varchar(1000);
|
||||
declare s_y varchar(1000);
|
||||
begin
|
||||
s_x = 'select count(*) from test where x = :input_arg or :input_arg is null';
|
||||
s_y = 'select count(*) from test where x + y <= :input_sum and x - y >= :input_arg or :input_sum is null';
|
||||
execute statement (s_x) ( input_arg := :i1 ) into n;
|
||||
execute statement (s_y) ( input_arg := :i1, input_sum := :i2 ) into n;
|
||||
end
|
||||
^
|
||||
set term ;^
|
||||
commit;
|
||||
|
||||
execute procedure sp_test( 65, 99 );
|
||||
|
||||
Trace log should contain following statistics for two ES:
|
||||
|
||||
Table Natural Index
|
||||
*****************************************************
|
||||
TEST 82
|
||||
|
||||
Table Natural Index
|
||||
*****************************************************
|
||||
TEST 90
|
||||
JIRA: CORE-3076
|
||||
"""
|
||||
|
||||
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='mon-stat-gathering-3_0.fbk')
|
||||
|
||||
substitutions_1 = []
|
||||
|
||||
init_script_1 = """"""
|
||||
|
||||
db_1 = db_factory(from_backup='mon-stat-gathering-3_0.fbk', init=init_script_1)
|
||||
|
||||
test_script_1 = """
|
||||
test_script = """
|
||||
set bail on;
|
||||
set term ^;
|
||||
execute block as
|
||||
@ -150,7 +137,7 @@ test_script_1 = """
|
||||
commit;
|
||||
|
||||
connect '$(DSN)' user 'SYSDBA' password 'masterkey'; -- mandatory!
|
||||
|
||||
|
||||
execute procedure sp_truncate_stat;
|
||||
commit;
|
||||
|
||||
@ -238,9 +225,9 @@ test_script_1 = """
|
||||
commit;
|
||||
|
||||
SET LIST ON;
|
||||
select *
|
||||
select *
|
||||
from (
|
||||
select
|
||||
select
|
||||
'When input arg is NOT null' as what_we_check,
|
||||
rowset,
|
||||
iif( natural_reads <= nr_threshold
|
||||
@ -252,7 +239,7 @@ test_script_1 = """
|
||||
', ir-cnt/3='|| coalesce(indexed_reads - total_rows/3.00, '<null>')
|
||||
) as result
|
||||
from (
|
||||
select
|
||||
select
|
||||
v.rowset
|
||||
,v.natural_reads
|
||||
,v.indexed_reads
|
||||
@ -264,8 +251,8 @@ test_script_1 = """
|
||||
)
|
||||
|
||||
UNION ALL
|
||||
|
||||
select
|
||||
|
||||
select
|
||||
'When input arg is NULL' as what_we_check,
|
||||
rowset,
|
||||
iif( natural_reads = total_rows
|
||||
@ -276,7 +263,7 @@ test_script_1 = """
|
||||
', IR='|| coalesce(indexed_reads, '<null>')
|
||||
) as result
|
||||
from (
|
||||
select v.rowset, v.natural_reads, v.indexed_reads, c.q as total_rows
|
||||
select v.rowset, v.natural_reads, v.indexed_reads, c.q as total_rows
|
||||
from v_agg_stat v cross join tcnt c
|
||||
where rowset > 6
|
||||
)
|
||||
@ -284,9 +271,9 @@ test_script_1 = """
|
||||
order by rowset;
|
||||
"""
|
||||
|
||||
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
|
||||
act = isql_act('db', test_script)
|
||||
|
||||
expected_stdout_1 = """
|
||||
expected_stdout = """
|
||||
WHAT_WE_CHECK When input arg is NOT null
|
||||
ROWSET 1
|
||||
RESULT OK
|
||||
@ -321,8 +308,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,36 +1,29 @@
|
||||
#coding:utf-8
|
||||
#
|
||||
# id: bugs.core_3085
|
||||
# title: Add clause ALTER DOMAIN <name> {DROP | SET} NOT NULL
|
||||
# decription:
|
||||
# tracker_id: CORE-3085
|
||||
# min_versions: ['3.0']
|
||||
# versions: 3.0
|
||||
# qmid: None
|
||||
|
||||
"""
|
||||
ID: issue-3464
|
||||
ISSUE: 3464
|
||||
TITLE: Add clause ALTER DOMAIN <name> {DROP | SET} NOT NULL
|
||||
DESCRIPTION:
|
||||
JIRA: CORE-3085
|
||||
"""
|
||||
|
||||
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 = """
|
||||
create domain dm_int int;
|
||||
test_script = """
|
||||
create domain dm_int int;
|
||||
commit;
|
||||
create table t(x dm_int);
|
||||
create table t(x dm_int);
|
||||
commit;
|
||||
|
||||
set term ^;
|
||||
create procedure p(a dm_int) returns(msg varchar(30)) as
|
||||
begin
|
||||
msg='intro proc p: a=' || coalesce(a, 'null');
|
||||
suspend;
|
||||
create procedure p(a dm_int) returns(msg varchar(30)) as
|
||||
begin
|
||||
msg='intro proc p: a=' || coalesce(a, 'null');
|
||||
suspend;
|
||||
end
|
||||
^
|
||||
set term ;^
|
||||
@ -60,13 +53,14 @@ test_script_1 = """
|
||||
alter domain dm_int set not null;
|
||||
"""
|
||||
|
||||
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
|
||||
act = isql_act('db', test_script)
|
||||
|
||||
expected_stdout_1 = """
|
||||
expected_stdout = """
|
||||
MSG intro proc p: a=null
|
||||
X <null>
|
||||
"""
|
||||
expected_stderr_1 = """
|
||||
|
||||
expected_stderr = """
|
||||
Statement failed, SQLSTATE = 42000
|
||||
validation error for variable A, value "*** null ***"
|
||||
-At procedure 'P'
|
||||
@ -78,10 +72,10 @@ expected_stderr_1 = """
|
||||
"""
|
||||
|
||||
@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_stderr == act_1.clean_expected_stderr
|
||||
assert act_1.clean_stdout == act_1.clean_expected_stdout
|
||||
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,30 +1,25 @@
|
||||
#coding:utf-8
|
||||
#
|
||||
# id: bugs.core_3090
|
||||
# title: Incorrect LEFT JOIN result using table and derived constant subquery
|
||||
# decription:
|
||||
# tracker_id: CORE-3090
|
||||
# min_versions: ['2.5.0']
|
||||
# versions: 3.0
|
||||
# qmid: None
|
||||
|
||||
"""
|
||||
ID: issue-3469
|
||||
ISSUE: 3469
|
||||
TITLE: Incorrect LEFT JOIN result using table and derived constant subquery
|
||||
DESCRIPTION:
|
||||
JIRA: CORE-3090
|
||||
"""
|
||||
|
||||
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 = """recreate table test_err (id int);
|
||||
init_script = """recreate table test_err (id int);
|
||||
insert into test_err (ID) values (1);
|
||||
insert into test_err (ID) values (2);
|
||||
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 *
|
||||
test_script = """select *
|
||||
from test_err t
|
||||
left join (select 1 id from rdb$database) a on a.id = t.id;
|
||||
select
|
||||
@ -38,9 +33,9 @@ from (select
|
||||
left join RDB$DATABASE on 1=0;
|
||||
"""
|
||||
|
||||
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
|
||||
============ ============
|
||||
1 1
|
||||
@ -54,8 +49,8 @@ Well
|
||||
"""
|
||||
|
||||
@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_3091
|
||||
# title: Built-in function POWER(X, Y) does not work when the X argument is negative and the Y value is scaled numeric but integral
|
||||
# decription:
|
||||
# tracker_id: CORE-3091
|
||||
# min_versions: ['2.1.4']
|
||||
# versions: 3.0
|
||||
# qmid: None
|
||||
|
||||
"""
|
||||
ID: issue-3470
|
||||
ISSUE: 3470
|
||||
TITLE: Built-in function POWER(X, Y) does not work when the X argument is negative and the Y value is scaled numeric but integral
|
||||
DESCRIPTION:
|
||||
JIRA: CORE-3091
|
||||
"""
|
||||
|
||||
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 = """select 'power( 3, 2 )', power( 3, 2 ) from RDB$DATABASE
|
||||
test_script = """select 'power( 3, 2 )', power( 3, 2 ) from RDB$DATABASE
|
||||
union all
|
||||
select 'power( -3, 2 )', power( -3, 2 ) from RDB$DATABASE
|
||||
union all
|
||||
@ -51,9 +44,9 @@ union all
|
||||
select 'power( 3.0, -2 )', power( 3.0, -2 ) 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 = """
|
||||
|
||||
=================== =======================
|
||||
power( 3, 2 ) 9.000000000000000
|
||||
@ -75,8 +68,8 @@ power( 3.0, -2 ) 0.1111111111111111
|
||||
"""
|
||||
|
||||
@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_3092
|
||||
# title: ROW_COUNT is not cleared before the singleton INSERT statement
|
||||
# decription:
|
||||
# tracker_id: CORE-3092
|
||||
# min_versions: ['2.1.5']
|
||||
# versions: 2.1.5
|
||||
# qmid: None
|
||||
|
||||
"""
|
||||
ID: issue-3471
|
||||
ISSUE: 3471
|
||||
TITLE: ROW_COUNT is not cleared before the singleton INSERT statement
|
||||
DESCRIPTION:
|
||||
JIRA: CORE-3092
|
||||
"""
|
||||
|
||||
import pytest
|
||||
from firebird.qa import db_factory, isql_act, Action
|
||||
from firebird.qa import *
|
||||
|
||||
# version: 2.1.5
|
||||
# resources: None
|
||||
|
||||
substitutions_1 = [('[ \t]+', ' ')]
|
||||
|
||||
init_script_1 = """
|
||||
init_script = """
|
||||
CREATE TABLE DELME (
|
||||
A INTEGER,
|
||||
B INTEGER
|
||||
@ -56,22 +51,22 @@ 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;
|
||||
execute procedure uui;
|
||||
"""
|
||||
|
||||
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
|
||||
act = isql_act('db', test_script, substitutions=[('[ \t]+', ' ')])
|
||||
|
||||
expected_stdout_1 = """
|
||||
RESULT update-1 1; update-2 1; insert-1 1;
|
||||
expected_stdout = """
|
||||
RESULT update-1 1; update-2 1; insert-1 1;
|
||||
"""
|
||||
|
||||
@pytest.mark.version('>=2.1.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
|
||||
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_3094
|
||||
# title: Parameters doesn't work with NOT IN from a selectable procedure
|
||||
# decription:
|
||||
# tracker_id: CORE-3094
|
||||
# min_versions: ['2.5.0']
|
||||
# versions: 2.5
|
||||
# qmid: None
|
||||
|
||||
"""
|
||||
ID: issue-3473
|
||||
ISSUE: 3473
|
||||
TITLE: Parameters doesn't work with NOT IN from a selectable procedure
|
||||
DESCRIPTION:
|
||||
JIRA: CORE-3094
|
||||
"""
|
||||
|
||||
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 = """
|
||||
create or alter procedure sp_test as begin end;
|
||||
recreate table con_miem (
|
||||
fgrupo int,
|
||||
@ -39,7 +32,7 @@ test_script_1 = """
|
||||
end
|
||||
^ set term ;^
|
||||
commit;
|
||||
|
||||
|
||||
insert into con_cuen (fcuenta, fnombre) values (5000, 'cuenta 5000');
|
||||
insert into con_cuen (fcuenta, fnombre) values (6000, 'cuenta 6000');
|
||||
insert into con_cuen (fcuenta, fnombre) values (7101, 'cuenta 7101');
|
||||
@ -60,8 +53,8 @@ test_script_1 = """
|
||||
insert into con_cuen (fcuenta, fnombre) values (7117, 'cuenta 7117');
|
||||
insert into con_cuen (fcuenta, fnombre) values (7118, 'cuenta 7118');
|
||||
insert into con_cuen (fcuenta, fnombre) values (7119, 'cuenta 7119');
|
||||
|
||||
|
||||
|
||||
|
||||
insert into con_miem (fgrupo, fmiembr) values (100, 5000);
|
||||
insert into con_miem (fgrupo, fmiembr) values (100, 6000);
|
||||
insert into con_miem (fgrupo, fmiembr) values (100, 7101);
|
||||
@ -83,7 +76,7 @@ test_script_1 = """
|
||||
insert into con_miem (fgrupo, fmiembr) values (100, 7118);
|
||||
insert into con_miem (fgrupo, fmiembr) values (100, 7119);
|
||||
commit;
|
||||
|
||||
|
||||
set list on;
|
||||
set term ^;
|
||||
execute block returns (fcuenta type of column con_miem.fmiembr, fnombre type of column con_cuen.fnombre)
|
||||
@ -104,10 +97,11 @@ test_script_1 = """
|
||||
set term ;^
|
||||
"""
|
||||
|
||||
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,31 +1,19 @@
|
||||
#coding:utf-8
|
||||
#
|
||||
# id: bugs.core_3095
|
||||
# title: Client receive event's with count equal to 1 despite of how many times EVENT was POSTed in same transaction
|
||||
# decription:
|
||||
# We create stored procedure as it was specified in the ticket, and call it with input arg = 3.
|
||||
# This mean that we have to receive THREE events after code which calls this SP will issue COMMIT.
|
||||
#
|
||||
# Confirmed on 2.5.0.26074 - only one event was delivered instead of three.
|
||||
# Works OK since 2.5.1.26351.
|
||||
#
|
||||
# PS. Event handling code in this text was adapted from fdb manual:
|
||||
# http://pythonhosted.org/fdb/usage-guide.html#database-events
|
||||
#
|
||||
# tracker_id: CORE-3095
|
||||
# min_versions: ['2.5.1']
|
||||
# versions: 2.5.1
|
||||
# qmid: None
|
||||
|
||||
"""
|
||||
ID: issue-3474
|
||||
ISSUE: 3474
|
||||
TITLE: Client receive event's with count equal to 1 despite of how many times EVENT was POSTed in same transaction
|
||||
DESCRIPTION:
|
||||
We create stored procedure as it was specified in the ticket, and call it with input arg = 3.
|
||||
This mean that we have to receive THREE events after code which calls this SP will issue COMMIT.
|
||||
JIRA: CORE-3095
|
||||
"""
|
||||
|
||||
import pytest
|
||||
from firebird.qa import db_factory, python_act, Action
|
||||
from firebird.qa import *
|
||||
|
||||
# version: 2.5.1
|
||||
# resources: None
|
||||
|
||||
substitutions_1 = []
|
||||
|
||||
init_script_1 = """
|
||||
init_script = """
|
||||
set term ^;
|
||||
create or alter procedure sp_test (a_evt_count int) as
|
||||
begin
|
||||
@ -40,67 +28,22 @@ 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 threading
|
||||
#
|
||||
# os.environ["ISC_USER"] = user_name
|
||||
# os.environ["ISC_PASSWORD"] = user_password
|
||||
#
|
||||
# # Utility function
|
||||
# def send_events(command_list):
|
||||
# cur = db_conn.cursor()
|
||||
# for cmd in command_list:
|
||||
# cur.execute(cmd)
|
||||
# db_conn.commit()
|
||||
#
|
||||
# timed_event = threading.Timer(3.0, send_events, args=[["execute procedure sp_test(3)",]])
|
||||
#
|
||||
# # Connection.event_conduit() takes a sequence of string event names as parameter, and returns
|
||||
# # EventConduit instance.
|
||||
# events = db_conn.event_conduit(['loop'])
|
||||
#
|
||||
# # To start listening for events it's necessary (starting from FDB version 1.4.2)
|
||||
# # to call EventConduit.begin() method or use EventConduit's context manager interface
|
||||
# # Immediately when begin() method is called, EventConduit starts to accumulate notifications
|
||||
# # of any events that occur within the conduit's internal queue until the conduit is closed
|
||||
# # (via the close() method)
|
||||
#
|
||||
# events.begin()
|
||||
#
|
||||
# timed_event.start()
|
||||
#
|
||||
# # Notifications about events are aquired through call to wait() method, that blocks the calling
|
||||
# # thread until at least one of the events occurs, or the specified timeout (if any) expires,
|
||||
# # and returns None if the wait timed out, or a dictionary that maps event_name -> event_occurrence_count.
|
||||
#
|
||||
# e = events.wait(10)
|
||||
#
|
||||
# events.close()
|
||||
#
|
||||
# print(e)
|
||||
# db_conn.close()
|
||||
#
|
||||
#
|
||||
#---
|
||||
act = python_act('db')
|
||||
|
||||
act_1 = python_act('db_1', substitutions=substitutions_1)
|
||||
|
||||
expected_stdout_1 = """
|
||||
expected_stdout = """
|
||||
{'loop': 3}
|
||||
"""
|
||||
|
||||
@pytest.mark.version('>=3.0')
|
||||
def test_1(act_1: Action, capsys):
|
||||
act_1.expected_stdout = expected_stdout_1
|
||||
with act_1.db.connect() as con:
|
||||
def test_1(act: Action, capsys):
|
||||
act.expected_stdout = expected_stdout
|
||||
with act.db.connect() as con:
|
||||
c = con.cursor()
|
||||
with con.event_collector(['loop']) as events:
|
||||
c.execute('execute procedure sp_test(3)')
|
||||
con.commit()
|
||||
print(events.wait(10))
|
||||
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,33 +1,22 @@
|
||||
#coding:utf-8
|
||||
#
|
||||
# id: bugs.core_3097
|
||||
# title: Updating blob field cause server crash with ACCESS_VIOLATION exception
|
||||
# decription:
|
||||
# Checked on: WI-V2.5.6.27001, WI-V3.0.0.32487, WI-T4.0.0.141
|
||||
#
|
||||
# tracker_id: CORE-3097
|
||||
# min_versions: ['2.5']
|
||||
# versions: 3.0
|
||||
# qmid: None
|
||||
|
||||
"""
|
||||
ID: issue-3476
|
||||
ISSUE: 3476
|
||||
TITLE: Updating blob field cause server crash with ACCESS_VIOLATION exception
|
||||
DESCRIPTION:
|
||||
JIRA: CORE-3097
|
||||
"""
|
||||
|
||||
import pytest
|
||||
from zipfile import Path
|
||||
from firebird.qa import db_factory, isql_act, Action
|
||||
from firebird.qa import *
|
||||
|
||||
# version: 3.0
|
||||
# resources: None
|
||||
db = db_factory()
|
||||
|
||||
substitutions_1 = []
|
||||
act = isql_act('db', '')
|
||||
|
||||
init_script_1 = """"""
|
||||
|
||||
db_1 = db_factory(sql_dialect=3, init=init_script_1)
|
||||
|
||||
test_script_1 = """"""
|
||||
|
||||
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
|
||||
|
||||
expected_stdout_1 = """
|
||||
expected_stdout = """
|
||||
ID 32765
|
||||
CHAR_LENGTH 32765
|
||||
OCTET_LENGTH 32765
|
||||
@ -65,7 +54,7 @@ expected_stdout_1 = """
|
||||
OCTET_LENGTH 65535
|
||||
"""
|
||||
|
||||
expected_stderr_1 = """
|
||||
expected_stderr = """
|
||||
Statement failed, SQLSTATE = 42000
|
||||
Dynamic SQL Error
|
||||
-SQL error code = -104
|
||||
@ -73,13 +62,13 @@ expected_stderr_1 = """
|
||||
"""
|
||||
|
||||
@pytest.mark.version('>=3.0')
|
||||
def test_1(act_1: Action):
|
||||
script_file = Path(act_1.files_dir / 'core_3097.zip',
|
||||
def test_1(act: Action):
|
||||
script_file = Path(act.files_dir / 'core_3097.zip',
|
||||
at='core_3097_script.sql')
|
||||
act_1.script = script_file.read_text()
|
||||
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
|
||||
act.script = script_file.read_text()
|
||||
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,23 +1,17 @@
|
||||
#coding:utf-8
|
||||
#
|
||||
# id: bugs.core_3100
|
||||
# title: Wait mode and lock timeout of external transaction of EXECUTE STATEMENT not matched to corresponding parameters of local transaction
|
||||
# decription:
|
||||
# Checked on: 4.0.0.1635 SS, 4.0.0.1633 CS: OK, 2.319s; 3.0.5.33180 SS, 3.0.5.33178 CS: OK, 2.215s.
|
||||
# tracker_id: CORE-3100
|
||||
# min_versions: ['3.0']
|
||||
# versions: 3.0
|
||||
# qmid: None
|
||||
|
||||
"""
|
||||
ID: issue-3478
|
||||
ISSUE: 3478
|
||||
TITLE: Wait mode and lock timeout of external transaction of EXECUTE STATEMENT not matched to corresponding parameters of local transaction
|
||||
DESCRIPTION:
|
||||
JIRA: CORE-3100
|
||||
"""
|
||||
|
||||
import pytest
|
||||
from firebird.qa import db_factory, isql_act, Action
|
||||
from firebird.qa import *
|
||||
|
||||
# version: 3.0
|
||||
# resources: None
|
||||
|
||||
substitutions_1 = [('Statement failed, SQLSTATE.*', ''), ('record not found for user:.*', '')]
|
||||
|
||||
init_script_1 = """
|
||||
init_script = """
|
||||
create or alter procedure sp_add_trn_data (a_run_no smallint) as begin end;
|
||||
commit;
|
||||
|
||||
@ -147,9 +141,9 @@ init_script_1 = """
|
||||
|
||||
"""
|
||||
|
||||
db_1 = db_factory(sql_dialect=3, init=init_script_1)
|
||||
db = db_factory(init=init_script)
|
||||
|
||||
test_script_1 = """
|
||||
test_script = """
|
||||
drop user tmp$c3100a;
|
||||
commit;
|
||||
create user tmp$c3100a password 'tmp$c3100a';
|
||||
@ -223,9 +217,11 @@ test_script_1 = """
|
||||
commit;
|
||||
"""
|
||||
|
||||
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
|
||||
act = isql_act('db', test_script,
|
||||
substitutions=[('Statement failed, SQLSTATE.*', 'Statement failed'),
|
||||
('record not found for user:.*', 'record not found for user')])
|
||||
|
||||
expected_stdout_1 = """
|
||||
expected_stdout = """
|
||||
RUN_NO 1
|
||||
TRN_DISTINCT_COUNT 3
|
||||
WAIT_DISTINCT_COUNT 1
|
||||
@ -247,7 +243,7 @@ expected_stdout_1 = """
|
||||
ISOL_DISTINCT_COUNT 1
|
||||
"""
|
||||
|
||||
expected_stderr_1 = """
|
||||
expected_stderr = """
|
||||
Statement failed, SQLSTATE = HY000
|
||||
record not found for user: TMP$C3100A
|
||||
Statement failed, SQLSTATE = HY000
|
||||
@ -255,9 +251,9 @@ record not found for user: TMP$C3100B
|
||||
"""
|
||||
|
||||
@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
|
||||
|
||||
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,43 +1,36 @@
|
||||
#coding:utf-8
|
||||
#
|
||||
# id: bugs.core_3101
|
||||
# title: Cannot alter the domain after migrating from older versions
|
||||
# decription:
|
||||
# tracker_id: CORE-3101
|
||||
# min_versions: ['2.5.0']
|
||||
# versions: 2.5
|
||||
# qmid: None
|
||||
|
||||
"""
|
||||
ID: issue-3479
|
||||
ISSUE: 3479
|
||||
TITLE: Cannot alter the domain after migrating from older versions
|
||||
DESCRIPTION:
|
||||
JIRA: CORE-3101
|
||||
"""
|
||||
|
||||
import pytest
|
||||
from firebird.qa import db_factory, isql_act, Action
|
||||
from firebird.qa import *
|
||||
|
||||
# version: 2.5
|
||||
# resources: None
|
||||
db = db_factory(from_backup='core3101-ods11.fbk')
|
||||
|
||||
substitutions_1 = []
|
||||
|
||||
init_script_1 = """"""
|
||||
|
||||
db_1 = db_factory(from_backup='core3101-ods11.fbk', init=init_script_1)
|
||||
|
||||
test_script_1 = """
|
||||
test_script = """
|
||||
show domain state;
|
||||
alter domain state set default 0;
|
||||
commit;
|
||||
show domain state;
|
||||
"""
|
||||
|
||||
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
|
||||
act = isql_act('db', test_script)
|
||||
|
||||
expected_stdout_1 = """
|
||||
expected_stdout = """
|
||||
STATE SMALLINT Nullable
|
||||
STATE SMALLINT Nullable
|
||||
default 0
|
||||
"""
|
||||
|
||||
@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,20 @@
|
||||
#coding:utf-8
|
||||
#
|
||||
# id: bugs.core_3103
|
||||
# title: BAD PLAN with using LEFT OUTER JOIN in SUBSELECT. See also: CORE-3283
|
||||
# decription: Ticket subj: Select statement with more non indexed reads in version 2.5RC3 as in version 2.1.3
|
||||
# tracker_id: CORE-3103
|
||||
# min_versions: ['2.1.7']
|
||||
# versions: 2.1.7
|
||||
# qmid: None
|
||||
|
||||
"""
|
||||
ID: issue-3481-3651
|
||||
ISSUE: 3481, 3651
|
||||
TITLE: BAD PLAN with using LEFT OUTER JOIN in SUBSELECT
|
||||
DESCRIPTION:
|
||||
Ticket subj: Select statement with more non indexed reads in version 2.5RC3 as in version 2.1.3
|
||||
JIRA: CORE-3103
|
||||
"""
|
||||
|
||||
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 = """
|
||||
set term ^;
|
||||
execute block as
|
||||
begin
|
||||
@ -31,7 +25,7 @@ test_script_1 = """
|
||||
commit;
|
||||
create sequence g;
|
||||
commit;
|
||||
|
||||
|
||||
recreate table bauf(id int);
|
||||
commit;
|
||||
recreate table bstammdaten(
|
||||
@ -48,7 +42,7 @@ test_script_1 = """
|
||||
using index fk_bauf_bstammdaten_id
|
||||
);
|
||||
commit;
|
||||
|
||||
|
||||
set term ^;
|
||||
execute block as
|
||||
declare n_main int = 5000; -- 42000;
|
||||
@ -65,14 +59,14 @@ test_script_1 = """
|
||||
end
|
||||
^set term ;^
|
||||
commit;
|
||||
|
||||
|
||||
create index bstammdaten_maskenkey on bstammdaten(maskenkey);
|
||||
commit;
|
||||
set statistics index fk_bauf_bstammdaten_id;
|
||||
set statistics index bstammdaten_id_pk;
|
||||
commit;
|
||||
|
||||
|
||||
|
||||
|
||||
set planonly;
|
||||
select count(*) from bauf
|
||||
where id =
|
||||
@ -84,16 +78,16 @@ test_script_1 = """
|
||||
commit;
|
||||
"""
|
||||
|
||||
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
|
||||
act = isql_act('db', test_script)
|
||||
|
||||
expected_stdout_1 = """
|
||||
expected_stdout = """
|
||||
PLAN JOIN (A INDEX (BSTAMMDATEN_MASKENKEY), B INDEX (FK_BAUF_BSTAMMDATEN_ID))
|
||||
PLAN (BAUF INDEX (BAUF_PK))
|
||||
"""
|
||||
|
||||
@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,207 +1,22 @@
|
||||
#coding:utf-8
|
||||
#
|
||||
# id: bugs.core_3131
|
||||
# title: WIN1257_LV (Latvian) collation is wrong for 4 letters: A E I U.
|
||||
# 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 = win1257 and set encoding for new document = WIN1257
|
||||
# (e.g. in Notepad++ pull-down menu: "Encoding / Character sets / Baltic / Windows 1257")
|
||||
# 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_win1257.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_win1257.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_win1257.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.
|
||||
#
|
||||
# 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 (WIN1257 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='cp1257').
|
||||
# Finally, its content will be converted to UTF8 for showing in expected_stdout.
|
||||
#
|
||||
# Confirmed bug on 2.5.0.26074. Fixed on 2.5.1.26351 and up to 2.5.9.27152
|
||||
#
|
||||
# Checked on:
|
||||
# * Windows: 4.0.0.2377, 3.0.8.33423
|
||||
# * Linux: 4.0.0.2379, 3.0.8.33415
|
||||
#
|
||||
# tracker_id: CORE-3131
|
||||
# min_versions: ['2.5.0']
|
||||
# versions: 2.5
|
||||
# qmid: None
|
||||
|
||||
"""
|
||||
ID: issue-3508
|
||||
ISSUE: 3508
|
||||
TITLE: WIN1257_LV (Latvian) collation is wrong for 4 letters: A E I U
|
||||
DESCRIPTION:
|
||||
JIRA: CORE-3131
|
||||
"""
|
||||
|
||||
import pytest
|
||||
from pathlib import Path
|
||||
from firebird.qa import db_factory, python_act, Action, temp_file
|
||||
from firebird.qa import *
|
||||
|
||||
# version: 2.5
|
||||
# resources: None
|
||||
db = db_factory(charset='WIN1257')
|
||||
|
||||
substitutions_1 = []
|
||||
act = python_act('db')
|
||||
|
||||
init_script_1 = """"""
|
||||
|
||||
db_1 = db_factory(charset='WIN1257', 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 win1257;
|
||||
# connect '%(dsn)s' user '%(user_name)s' password '%(user_password)s';
|
||||
#
|
||||
# create collation coll_1257_ci_ai
|
||||
# for win1257 from win1257_lv
|
||||
# no pad case insensitive accent sensitive;
|
||||
# commit;
|
||||
#
|
||||
# create table test1257 (
|
||||
# letter varchar(2) collate coll_1257_ci_ai,
|
||||
# sort_index smallint
|
||||
# );
|
||||
#
|
||||
# -- ### ONCE AGAIN ###
|
||||
# -- 1) for checking this under ISQL following must be encoded in WIN1257
|
||||
# -- 2) for running under fbt_run utility following must be encoded in UTF8.
|
||||
# insert into test1257 values ('Iz', 18);
|
||||
# insert into test1257 values ('Īb', 19);
|
||||
# insert into test1257 values ('Īz', 20);
|
||||
#
|
||||
# insert into test1257 values ('Ķz', 24);
|
||||
# insert into test1257 values ('Ēz', 12);
|
||||
# insert into test1257 values ('Gb', 13);
|
||||
#
|
||||
# insert into test1257 values ('Ģz', 16);
|
||||
# insert into test1257 values ('Ib', 17);
|
||||
#
|
||||
# insert into test1257 values ('Gz', 14);
|
||||
# insert into test1257 values ('Ģb', 15);
|
||||
#
|
||||
# insert into test1257 values ('Ņb', 31);
|
||||
# insert into test1257 values ('Ņz', 32);
|
||||
# insert into test1257 values ('Cb', 5);
|
||||
# insert into test1257 values ('Ūb', 39);
|
||||
# insert into test1257 values ('Ūz', 40);
|
||||
# insert into test1257 values ('Zb', 41);
|
||||
# insert into test1257 values ('Eb', 9);
|
||||
# insert into test1257 values ('Ez', 10);
|
||||
# insert into test1257 values ('Ēb', 11);
|
||||
#
|
||||
# insert into test1257 values ('Ub', 37);
|
||||
# insert into test1257 values ('Uz', 38);
|
||||
#
|
||||
# insert into test1257 values ('Lz', 26);
|
||||
# insert into test1257 values ('Ļb', 27);
|
||||
# insert into test1257 values ('Ļz', 28);
|
||||
# insert into test1257 values ('Kb', 21);
|
||||
# insert into test1257 values ('Kz', 22);
|
||||
# insert into test1257 values ('Šz', 36);
|
||||
# insert into test1257 values ('Lb', 25);
|
||||
# insert into test1257 values ('Cz', 6);
|
||||
# insert into test1257 values ('Čb', 7);
|
||||
# insert into test1257 values ('Čz', 8);
|
||||
#
|
||||
# insert into test1257 values ('Sb', 33);
|
||||
# insert into test1257 values ('Sz', 34);
|
||||
# insert into test1257 values ('Šb', 35);
|
||||
#
|
||||
# insert into test1257 values ('Nb', 29);
|
||||
# insert into test1257 values ('Nz', 30);
|
||||
# insert into test1257 values ('Ķb', 23);
|
||||
# insert into test1257 values ('Zz', 42);
|
||||
# insert into test1257 values ('Žb', 43);
|
||||
# insert into test1257 values ('Žz', 44);
|
||||
#
|
||||
# insert into test1257 values ('Ab', 1);
|
||||
# insert into test1257 values ('Az', 2);
|
||||
# insert into test1257 values ('Āb', 3);
|
||||
# insert into test1257 values ('Āz', 4);
|
||||
# commit;
|
||||
#
|
||||
# set heading off;
|
||||
# select *
|
||||
# from test1257 tls
|
||||
# order by tls.letter collate coll_1257_ci_ai;
|
||||
#
|
||||
# ''' % dict(globals(), **locals())
|
||||
#
|
||||
# f_run_sql = open( os.path.join(context['temp_directory'], 'tmp_3131_win1257.sql'), 'w' )
|
||||
# f_run_sql.write( sql_txt.decode('utf8').encode('cp1257') )
|
||||
# flush_and_close( f_run_sql )
|
||||
#
|
||||
# # result: file tmp_3131_win1257.sql is encoded in win1257
|
||||
#
|
||||
# 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 win1257
|
||||
#
|
||||
# with codecs.open(f_run_log.name, 'r', encoding='cp1257' ) as f:
|
||||
# result_in_win1257 = f.readlines()
|
||||
#
|
||||
# for i in result_in_win1257:
|
||||
# print( i.encode('utf8') )
|
||||
#
|
||||
# # cleanup:
|
||||
# ###########
|
||||
# cleanup( (f_run_sql, f_run_log) )
|
||||
#
|
||||
#
|
||||
#---
|
||||
|
||||
act_1 = python_act('db_1', substitutions=substitutions_1)
|
||||
|
||||
test_script_1 = """
|
||||
test_script = """
|
||||
set bail on;
|
||||
set names win1257;
|
||||
|
||||
@ -283,7 +98,7 @@ test_script_1 = """
|
||||
order by tls.letter collate coll_1257_ci_ai;
|
||||
"""
|
||||
|
||||
expected_stdout_1 = """
|
||||
expected_stdout = """
|
||||
Ab 1
|
||||
Az 2
|
||||
Āb 3
|
||||
@ -333,10 +148,10 @@ expected_stdout_1 = """
|
||||
|
||||
script_file = temp_file('test-script.sql')
|
||||
|
||||
@pytest.mark.version('>=2.5')
|
||||
def test_1(act_1: Action, script_file: Path):
|
||||
script_file.write_text(test_script_1, encoding='cp1257')
|
||||
act_1.expected_stdout = expected_stdout_1
|
||||
act_1.isql(switches=[], input_file=script_file, charset='WIN1257')
|
||||
assert act_1.clean_stdout == act_1.clean_expected_stdout
|
||||
@pytest.mark.version('>=3')
|
||||
def test_1(act: Action, script_file: Path):
|
||||
script_file.write_text(test_script, encoding='cp1257')
|
||||
act.expected_stdout = expected_stdout
|
||||
act.isql(switches=[], input_file=script_file, charset='WIN1257')
|
||||
assert act.clean_stdout == act.clean_expected_stdout
|
||||
|
||||
|
@ -1,29 +1,24 @@
|
||||
#coding:utf-8
|
||||
#
|
||||
# id: bugs.core_3137
|
||||
# title: Partial rollback is possible for a selectable procedure modifying data
|
||||
# decription:
|
||||
# tracker_id: CORE-3137
|
||||
# min_versions: ['2.1.4']
|
||||
# versions: 2.1.4
|
||||
# qmid: None
|
||||
|
||||
"""
|
||||
ID: issue-3514
|
||||
ISSUE: 3514
|
||||
TITLE: Partial rollback is possible for a selectable procedure modifying data
|
||||
DESCRIPTION:
|
||||
JIRA: CORE-3137
|
||||
"""
|
||||
|
||||
import pytest
|
||||
from firebird.qa import db_factory, isql_act, Action
|
||||
from firebird.qa import *
|
||||
|
||||
# version: 2.1.4
|
||||
# resources: None
|
||||
|
||||
substitutions_1 = []
|
||||
|
||||
init_script_1 = """
|
||||
init_script = """
|
||||
create or alter procedure sp_01 returns (ret int) as begin end;
|
||||
commit;
|
||||
recreate table tab (col int);
|
||||
commit;
|
||||
insert into tab (col) values (1);
|
||||
commit;
|
||||
|
||||
|
||||
set term ^;
|
||||
create or alter procedure sp_01 returns (ret int) as
|
||||
begin
|
||||
@ -43,9 +38,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 = """
|
||||
set list on;
|
||||
select col from tab; -- returns 1
|
||||
commit;
|
||||
@ -54,20 +49,20 @@ test_script_1 = """
|
||||
rollback;
|
||||
|
||||
select col from tab; -- returns 2!!!
|
||||
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 = """
|
||||
COL 1
|
||||
RET 1
|
||||
COL 1
|
||||
"""
|
||||
|
||||
@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,26 +1,19 @@
|
||||
#coding:utf-8
|
||||
#
|
||||
# id: bugs.core_3140
|
||||
# title: Preserve comments for parameters after altering procedures
|
||||
# decription:
|
||||
# tracker_id: CORE-3140
|
||||
# min_versions: ['2.5.1']
|
||||
# versions: 2.5.1
|
||||
# qmid: None
|
||||
|
||||
"""
|
||||
ID: issue-3517
|
||||
ISSUE: 3517
|
||||
TITLE: Preserve comments for parameters after altering procedures
|
||||
DESCRIPTION:
|
||||
JIRA: CORE-3140
|
||||
"""
|
||||
|
||||
import pytest
|
||||
from firebird.qa import db_factory, isql_act, Action
|
||||
from firebird.qa import *
|
||||
|
||||
# version: 2.5.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 = """
|
||||
create or alter procedure sp_01 as begin end;
|
||||
commit;
|
||||
set term ^;
|
||||
@ -33,15 +26,15 @@ test_script_1 = """
|
||||
end^
|
||||
set term ;^
|
||||
commit;
|
||||
|
||||
|
||||
create domain dm_i int;
|
||||
create domain dm_s varchar(10);
|
||||
create domain dm_t timestamp;
|
||||
create domain dm_b blob;
|
||||
|
||||
|
||||
recreate table t_01(id int, s varchar(10), dts timestamp, b blob);
|
||||
commit;
|
||||
|
||||
|
||||
set term ^;
|
||||
create or alter procedure sp_01(
|
||||
a_01 int
|
||||
@ -69,7 +62,7 @@ test_script_1 = """
|
||||
comment on parameter sp_01.o_03 is 'OUTPUT par. ''o_03'', mech = 0';
|
||||
comment on parameter sp_01.o_04 is 'OUTPUT par. ''o_04'', mech = 0';
|
||||
commit;
|
||||
|
||||
|
||||
set term ^;
|
||||
alter procedure sp_01(
|
||||
a_01 int
|
||||
@ -80,7 +73,7 @@ test_script_1 = """
|
||||
,a_06 type of dm_s
|
||||
,a_07 type of dm_t
|
||||
,a_08 type of dm_b
|
||||
) returns (
|
||||
) returns (
|
||||
o_01 int
|
||||
,o_02 varchar(10)
|
||||
,o_03 timestamp
|
||||
@ -96,86 +89,86 @@ test_script_1 = """
|
||||
^
|
||||
set term ;^
|
||||
commit;
|
||||
|
||||
|
||||
comment on parameter sp_01.a_05 is 'added INPUT par ''a_05'', mech = 1';
|
||||
comment on parameter sp_01.a_06 is 'added INPUT par ''a_06'', mech = 1';
|
||||
comment on parameter sp_01.a_07 is 'added INPUT par ''a_07'', mech = 1';
|
||||
comment on parameter sp_01.a_08 is 'added INPUT par ''a_08'', mech = 1';
|
||||
|
||||
|
||||
comment on parameter sp_01.o_05 is 'added OUTPUT par ''o_05'', mech = 1';
|
||||
comment on parameter sp_01.o_06 is 'added OUTPUT par ''o_06'', mech = 1';
|
||||
comment on parameter sp_01.o_07 is 'added OUTPUT par ''o_07'', mech = 1';
|
||||
comment on parameter sp_01.o_08 is 'added OUTPUT par ''o_08'', mech = 1';
|
||||
commit;
|
||||
|
||||
set width par_name 31;
|
||||
set width par_desc 50;
|
||||
|
||||
set width par_name 31;
|
||||
set width par_desc 50;
|
||||
set list on;
|
||||
select
|
||||
cast(rdb$parameter_name as varchar(31)) par_name,
|
||||
cast(rdb$description as varchar(50)) par_desc,
|
||||
coalesce(rdb$parameter_mechanism, 0 ) par_mech
|
||||
from rdb$procedure_parameters
|
||||
select
|
||||
cast(rdb$parameter_name as varchar(31)) par_name,
|
||||
cast(rdb$description as varchar(50)) par_desc,
|
||||
coalesce(rdb$parameter_mechanism, 0 ) par_mech
|
||||
from rdb$procedure_parameters
|
||||
where rdb$procedure_name='SP_01'
|
||||
order by par_name;
|
||||
"""
|
||||
|
||||
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
|
||||
act = isql_act('db', test_script)
|
||||
|
||||
expected_stdout_1 = """
|
||||
PAR_NAME A_01
|
||||
expected_stdout = """
|
||||
PAR_NAME A_01
|
||||
PAR_DESC INPUT par. 'a_01', mech = 0
|
||||
PAR_MECH 0
|
||||
PAR_NAME A_02
|
||||
PAR_NAME A_02
|
||||
PAR_DESC INPUT par. 'a_02', mech = 0
|
||||
PAR_MECH 0
|
||||
PAR_NAME A_03
|
||||
PAR_NAME A_03
|
||||
PAR_DESC INPUT par. 'a_03', mech = 0
|
||||
PAR_MECH 0
|
||||
PAR_NAME A_04
|
||||
PAR_NAME A_04
|
||||
PAR_DESC INPUT par. 'a_04', mech = 0
|
||||
PAR_MECH 0
|
||||
PAR_NAME A_05
|
||||
PAR_NAME A_05
|
||||
PAR_DESC added INPUT par 'a_05', mech = 1
|
||||
PAR_MECH 1
|
||||
PAR_NAME A_06
|
||||
PAR_NAME A_06
|
||||
PAR_DESC added INPUT par 'a_06', mech = 1
|
||||
PAR_MECH 1
|
||||
PAR_NAME A_07
|
||||
PAR_NAME A_07
|
||||
PAR_DESC added INPUT par 'a_07', mech = 1
|
||||
PAR_MECH 1
|
||||
PAR_NAME A_08
|
||||
PAR_NAME A_08
|
||||
PAR_DESC added INPUT par 'a_08', mech = 1
|
||||
PAR_MECH 1
|
||||
PAR_NAME O_01
|
||||
PAR_NAME O_01
|
||||
PAR_DESC OUTPUT par. 'o_01', mech = 0
|
||||
PAR_MECH 0
|
||||
PAR_NAME O_02
|
||||
PAR_NAME O_02
|
||||
PAR_DESC OUTPUT par. 'o_02', mech = 0
|
||||
PAR_MECH 0
|
||||
PAR_NAME O_03
|
||||
PAR_NAME O_03
|
||||
PAR_DESC OUTPUT par. 'o_03', mech = 0
|
||||
PAR_MECH 0
|
||||
PAR_NAME O_04
|
||||
PAR_NAME O_04
|
||||
PAR_DESC OUTPUT par. 'o_04', mech = 0
|
||||
PAR_MECH 0
|
||||
PAR_NAME O_05
|
||||
PAR_NAME O_05
|
||||
PAR_DESC added OUTPUT par 'o_05', mech = 1
|
||||
PAR_MECH 1
|
||||
PAR_NAME O_06
|
||||
PAR_NAME O_06
|
||||
PAR_DESC added OUTPUT par 'o_06', mech = 1
|
||||
PAR_MECH 1
|
||||
PAR_NAME O_07
|
||||
PAR_NAME O_07
|
||||
PAR_DESC added OUTPUT par 'o_07', mech = 1
|
||||
PAR_MECH 1
|
||||
PAR_NAME O_08
|
||||
PAR_NAME O_08
|
||||
PAR_DESC added OUTPUT par 'o_08', mech = 1
|
||||
PAR_MECH 1
|
||||
"""
|
||||
|
||||
@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
|
||||
def test_1(act: Action):
|
||||
act.expected_stdout = expected_stdout
|
||||
act.execute()
|
||||
assert act.clean_stdout == act.clean_expected_stdout
|
||||
|
||||
|
@ -1,35 +1,22 @@
|
||||
#coding:utf-8
|
||||
#
|
||||
# id: bugs.core_3141
|
||||
# title: The last column in a view is returning as a null value even when it's not
|
||||
# decription:
|
||||
# Confirmed wrong resultset on 2.5.0.26074.
|
||||
# Checked on:
|
||||
# 4.0.0.1635 SS: 1.701s.
|
||||
# 3.0.5.33182 SS: 1.394s.
|
||||
# 2.5.9.27146 SC: 0.524s.
|
||||
# NB: new datatype in FB 4.0 was introduces: numeric(38,0).
|
||||
# It leads to additional ident of values when we show them in form "SET LIST ON",
|
||||
# so we have to ignore all internal spaces - see added 'substitution' section below.
|
||||
#
|
||||
# tracker_id: CORE-3141
|
||||
# min_versions: ['2.5.1']
|
||||
# versions: 2.5.1
|
||||
# qmid: None
|
||||
|
||||
"""
|
||||
ID: issue-3518
|
||||
ISSUE: 3518
|
||||
TITLE: The last column in a view is returning as a null value even when it's not
|
||||
DESCRIPTION:
|
||||
NB: new datatype in FB 4.0 was introduces: numeric(38,0).
|
||||
It leads to additional ident of values when we show them in form "SET LIST ON",
|
||||
so we have to ignore all internal spaces - see added 'substitution' section below.
|
||||
JIRA: CORE-3141
|
||||
"""
|
||||
|
||||
import pytest
|
||||
from firebird.qa import db_factory, isql_act, Action
|
||||
from firebird.qa import *
|
||||
|
||||
# version: 2.5.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;
|
||||
|
||||
create table test(
|
||||
@ -123,9 +110,9 @@ test_script_1 = """
|
||||
|
||||
"""
|
||||
|
||||
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 test_1a
|
||||
DATUM 2013-06-04
|
||||
A 30.00
|
||||
@ -148,9 +135,9 @@ expected_stdout_1 = """
|
||||
PLACER 10
|
||||
"""
|
||||
|
||||
@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,26 +1,19 @@
|
||||
#coding:utf-8
|
||||
#
|
||||
# id: bugs.core_3164
|
||||
# title: Parameterized requests involving blob fields fails when connected using charset UTF8
|
||||
# decription:
|
||||
# tracker_id: CORE-3164
|
||||
# min_versions: ['2.5.1']
|
||||
# versions: 2.5.1
|
||||
# qmid: None
|
||||
|
||||
"""
|
||||
ID: issue-3539
|
||||
ISSUE: 3539
|
||||
TITLE: Parameterized requests involving blob fields fails when connected using charset UTF8
|
||||
DESCRIPTION:
|
||||
JIRA: CORE-3164
|
||||
"""
|
||||
|
||||
import pytest
|
||||
from firebird.qa import db_factory, isql_act, Action
|
||||
from firebird.qa import *
|
||||
|
||||
# version: 2.5.1
|
||||
# resources: None
|
||||
db = db_factory(charset='UTF8')
|
||||
|
||||
substitutions_1 = []
|
||||
|
||||
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 table test(fb blob);
|
||||
commit;
|
||||
insert into test values(rpad('', 7, 'foo') );
|
||||
@ -56,16 +49,16 @@ test_script_1 = """
|
||||
-- In 2.5.1: sqltype: 521 BLOB Nullable sqlscale: 0 sqlsubtype: 0 sqllen: 8
|
||||
"""
|
||||
|
||||
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
|
||||
act = isql_act('db', test_script)
|
||||
|
||||
expected_stdout_1 = """
|
||||
expected_stdout = """
|
||||
N 7
|
||||
N 8
|
||||
"""
|
||||
|
||||
@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,284 +1,41 @@
|
||||
#coding:utf-8
|
||||
#
|
||||
# id: bugs.core_3168
|
||||
# title: exclude_filter doesn't work for <services></section> section of the Trace facility
|
||||
# decription:
|
||||
# Note. It was encountered that FBSVCMGR does NOT wait for OS completes writing of its output on disk,
|
||||
# (see CORE-4896), so we use delays - see calls of time.sleep().
|
||||
#
|
||||
# Correct work was checked on: WI-V2.5.5.26916 (SS, SC) and WI-V3.0.0.31948 (SS, SC, CS)
|
||||
# Refactored 17.12.2016 after encountering CORE-5424 ("restore process is impossible when trace ..."):
|
||||
# added checking of STDERR logs for all fbsvcmgr actions.
|
||||
#
|
||||
# -----------------------------------------
|
||||
# Updated 27.03.2017: moved artificial delay (1 sec) at proper place.
|
||||
# It should be just after
|
||||
# subprocess.call('fbsvcmgr', 'localhost:service_mgr', 'action_trace_stop', ...)
|
||||
# and BEFORE 'p_trace.terminate()' command.
|
||||
# -----------------------------------------
|
||||
#
|
||||
# Test time (approx):
|
||||
# 2.5.7.27030: SC = 3"
|
||||
# 3.0.232644 and 4.0.0.463: SS = SC = 6"; CS = 15"
|
||||
# Checked on 2.5.8.27056, CLASSIC server: 3.6" (27-03-2017)
|
||||
#
|
||||
# 13.04.2021. Adapted for run both on Windows and Linux. Checked on:
|
||||
# Windows: 3.0.8.33445, 4.0.0.2416
|
||||
# Linux: 3.0.8.33426, 4.0.0.2416
|
||||
#
|
||||
#
|
||||
# tracker_id: CORE-3168
|
||||
# min_versions: ['2.5.0']
|
||||
# versions: 2.5
|
||||
# qmid: None
|
||||
|
||||
"""
|
||||
ID: issue-3543
|
||||
ISSUE: 3543
|
||||
TITLE: exclude_filter doesn't work for <services></section> section of the Trace facility
|
||||
DESCRIPTION:
|
||||
JIRA: CORE-3168
|
||||
"""
|
||||
|
||||
import pytest
|
||||
from io import BytesIO
|
||||
from firebird.qa import db_factory, python_act, Action, temp_file
|
||||
from firebird.qa import *
|
||||
from firebird.driver import SrvStatFlag
|
||||
|
||||
# version: 2.5
|
||||
# resources: None
|
||||
db = db_factory()
|
||||
|
||||
substitutions_1 = [('^((?!ERROR|ELEMENT|PROPERTIES|STATS|BACKUP|RESTORE).)*$', '')]
|
||||
act = python_act('db', substitutions=[('^((?!ERROR|ELEMENT|PROPERTIES|STATS|BACKUP|RESTORE).)*$', '')])
|
||||
|
||||
init_script_1 = """"""
|
||||
|
||||
db_1 = db_factory(sql_dialect=3, init=init_script_1)
|
||||
|
||||
# test_script_1
|
||||
#---
|
||||
#
|
||||
# import os
|
||||
# import subprocess
|
||||
# import time
|
||||
# from fdb import services
|
||||
# from subprocess import Popen
|
||||
#
|
||||
# os.environ["ISC_USER"] = user_name
|
||||
# os.environ["ISC_PASSWORD"] = user_password
|
||||
#
|
||||
# # Obtain engine version:
|
||||
# engine = str(db_conn.engine_version) # convert to text because 'float' object has no attribute 'startswith'
|
||||
# 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.')
|
||||
# print('type(f_names_list[i])=',type(f_names_list[i]))
|
||||
# del_name = None
|
||||
#
|
||||
# if del_name and os.path.isfile( del_name ):
|
||||
# os.remove( del_name )
|
||||
#
|
||||
# #--------------------------------------------
|
||||
#
|
||||
#
|
||||
# # ::: NB ::: Trace config file format in 3.0 differs from 2.5 one:
|
||||
# # 1) header section must be enclosed in "[" and "]",
|
||||
# # 2) parameter-value pairs must be separated with '=' sign:
|
||||
# # services
|
||||
# # {
|
||||
# # parameter = value
|
||||
# # }
|
||||
#
|
||||
# if engine.startswith('2.5'):
|
||||
# txt = '''# Generated auto, do not edit!
|
||||
# <services>
|
||||
# enabled true
|
||||
# log_services true
|
||||
#
|
||||
# # This should prevent appearance of messages like "List Trace Session(s)" or "Start Trace Session(s)":
|
||||
# exclude_filter "%(List|LIST|list|Start|START|start)[[:WHITESPACE:]]+(Trace|TRACE|trace)[[:WHITESPACE:]]+(Session|SESSION|session)%"
|
||||
#
|
||||
# # This should work even if we filter out messages about list/start trace session(s)
|
||||
# # (and test also check corret work of THIS filter beside previous `exclude`):
|
||||
# # include_filter "Database Stats"
|
||||
# </services>
|
||||
# '''
|
||||
# else:
|
||||
# txt = '''# Generated auto, do not edit!
|
||||
# services
|
||||
# {
|
||||
# enabled = true
|
||||
# log_services = true
|
||||
#
|
||||
# # This should prevent appearance of messages like "List Trace Session(s)" or "Start Trace Session(s)":
|
||||
# exclude_filter = "%(List|LIST|list|Start|START|start)[[:WHITESPACE:]]+(Trace|TRACE|trace)[[:WHITESPACE:]]+(Session|SESSION|session)%"
|
||||
#
|
||||
# # This should work even if we filter out messages about list/start trace session(s)
|
||||
# # (and test also check corret work of THIS filter beside previous `exclude`):
|
||||
# # include_filter = "Database Stats"
|
||||
# }
|
||||
# '''
|
||||
#
|
||||
# f_trc_cfg=open( os.path.join(context['temp_directory'],'tmp_trace_3168.cfg'), 'w')
|
||||
# f_trc_cfg.write(txt)
|
||||
# f_trc_cfg.close()
|
||||
#
|
||||
# # Instead of using 'start /min cmd /c fbsvcmgr ... 1>%2 2>&1' deciced to exploite Popen in order to run asynchronous process
|
||||
# # without opening separate window. Output is catched into `trclog` file, which will be closed after call fbsvcmgr with argument
|
||||
# # 'action_trace_stop' (see below):
|
||||
# # See also:
|
||||
# # https://docs.python.org/2/library/subprocess.html
|
||||
# # http://stackoverflow.com/questions/11801098/calling-app-from-subprocess-call-with-arguments
|
||||
#
|
||||
# # ##############################################################
|
||||
# # S T A R T T R A C E i n S E P A R A T E P R O C E S S
|
||||
# # ##############################################################
|
||||
#
|
||||
# f_trc_log=open( os.path.join(context['temp_directory'],'tmp_trace_3168.log'), "w")
|
||||
# f_trc_err=open( os.path.join(context['temp_directory'],'tmp_trace_3168.err'), "w")
|
||||
#
|
||||
# p_trace = Popen([ context['fbsvcmgr_path'], 'localhost:service_mgr', 'action_trace_start' , 'trc_cfg', f_trc_cfg.name],stdout=f_trc_log,stderr=f_trc_err)
|
||||
#
|
||||
# thisdb='$(DATABASE_LOCATION)bugs.core_3168.fdb'
|
||||
# tmpbkp='$(DATABASE_LOCATION)bugs.core_3168_fbk.tmp'
|
||||
# tmpres='$(DATABASE_LOCATION)bugs.core_3168_new.tmp'
|
||||
#
|
||||
# f_run_log=open( os.path.join(context['temp_directory'],'tmp_action_3168.log'), 'w')
|
||||
# f_run_err=open( os.path.join(context['temp_directory'],'tmp_action_3168.err'), 'w')
|
||||
#
|
||||
# subprocess.call( [ context['fbsvcmgr_path'], 'localhost:service_mgr','action_properties','dbname', thisdb,'prp_sweep_interval', '1234321'], stdout=f_run_log,stderr=f_run_err)
|
||||
# subprocess.call( [ context['fbsvcmgr_path'], 'localhost:service_mgr','action_db_stats', 'dbname', thisdb, 'sts_hdr_pages'], stdout=f_run_log,stderr=f_run_err)
|
||||
# subprocess.call( [ context['fbsvcmgr_path'], 'localhost:service_mgr','action_backup', 'dbname', thisdb, 'bkp_file', tmpbkp], stdout=f_run_log,stderr=f_run_err)
|
||||
# subprocess.call( [ context['fbsvcmgr_path'], 'localhost:service_mgr','action_restore', 'bkp_file', tmpbkp, 'dbname', tmpres, 'res_replace'], stdout=f_run_log,stderr=f_run_err)
|
||||
#
|
||||
# flush_and_close( f_run_log )
|
||||
# flush_and_close( f_run_err )
|
||||
#
|
||||
# # do NOT try to get FB log! It can contain non-ascii messages which lead to runtime fault of fbtest!
|
||||
# # (see CORE-5418):
|
||||
# # runProgram(context['fbsvcmgr_path'],['localhost:service_mgr','action_get_fb_log'])
|
||||
#
|
||||
#
|
||||
# # ####################################################
|
||||
# # G E T A C T I V E T R A C E S E S S I O N I D
|
||||
# # ####################################################
|
||||
# # Save active trace session info into file for further parsing it and obtain session_id back (for stop):
|
||||
#
|
||||
# f_trc_lst = open( os.path.join(context['temp_directory'],'tmp_trace_3168.lst'), 'w')
|
||||
# subprocess.call([context['fbsvcmgr_path'], 'localhost:service_mgr', 'action_trace_list'], stdout=f_trc_lst)
|
||||
# flush_and_close( f_trc_lst )
|
||||
#
|
||||
# # !!! DO NOT REMOVE THIS LINE !!!
|
||||
# time.sleep(1)
|
||||
#
|
||||
# trcssn=0
|
||||
# with open( f_trc_lst.name,'r') as f:
|
||||
# for line in f:
|
||||
# i=1
|
||||
# if 'Session ID' in line:
|
||||
# for word in line.split():
|
||||
# if i==3:
|
||||
# trcssn=word
|
||||
# i=i+1
|
||||
# break
|
||||
# # Result: `trcssn` is ID of active trace session. Now we have to terminate it:
|
||||
#
|
||||
# # ####################################################
|
||||
# # S E N D R E Q U E S T T R A C E T O S T O P
|
||||
# # ####################################################
|
||||
#
|
||||
# fn_nul = open(os.devnull, 'w')
|
||||
# subprocess.call([context['fbsvcmgr_path'], 'localhost:service_mgr', 'action_trace_stop','trc_id', trcssn], stdout=fn_nul)
|
||||
# fn_nul.close()
|
||||
#
|
||||
# # ::: NB ::: Artificial delay, Added 27.03.2017.
|
||||
# # Do NOT remove this line otherwise record with 'database restore' may not appear
|
||||
# # in the final trace log (file buffer is flushed not instantly).
|
||||
# time.sleep(1)
|
||||
#
|
||||
#
|
||||
# # Doc about Popen.terminate():
|
||||
# # https://docs.python.org/2/library/subprocess.html
|
||||
# # Stop the child. On Posix OSs the method sends SIGTERM to the child.
|
||||
# # On Windows the Win32 API function TerminateProcess() is called to stop the child.
|
||||
#
|
||||
# # Doc about Win API TerminateProcess() function:
|
||||
# # https://msdn.microsoft.com/en-us/library/windows/desktop/ms686714%28v=vs.85%29.aspx
|
||||
# # The terminated process cannot exit until all pending I/O has been completed or canceled.
|
||||
# # TerminateProcess is ____asynchronous____; it initiates termination and returns immediately.
|
||||
# # ^^^^^^^^^^^^
|
||||
#
|
||||
# p_trace.terminate()
|
||||
# flush_and_close(f_trc_log)
|
||||
# flush_and_close(f_trc_err)
|
||||
#
|
||||
# # Should be EMPTY:
|
||||
# with open( f_trc_err.name,'r') as f:
|
||||
# for line in f:
|
||||
# if line.split():
|
||||
# print('fbsvcmgr(1) unexpected STDERR: '+line.upper() )
|
||||
#
|
||||
# # Should be EMPTY:
|
||||
# with open( f_run_err.name,'r') as f:
|
||||
# for line in f:
|
||||
# if line.split():
|
||||
# print('fbsvcmgr(2) unexpected STDERR: '+line.upper() )
|
||||
#
|
||||
# # Output log of trace for comparing it with expected.
|
||||
# # ::: NB ::: Content if trace log is converted to UPPER case in order to reduce change of mismatching with
|
||||
# # updated trace output in some future versions:
|
||||
#
|
||||
# with open( f_trc_log.name,'r') as f:
|
||||
# for line in f:
|
||||
# if line.split():
|
||||
# print(line.upper())
|
||||
#
|
||||
# # CLEANUP
|
||||
# #########
|
||||
# time.sleep(1)
|
||||
# cleanup( (f_trc_cfg, f_trc_lst, f_trc_log, f_trc_err, f_run_log, f_run_err, tmpbkp, tmpres) )
|
||||
#
|
||||
#
|
||||
#---
|
||||
|
||||
act_1 = python_act('db_1', substitutions=substitutions_1)
|
||||
|
||||
expected_stdout_1 = """
|
||||
expected_stdout = """
|
||||
EXCLUDE_FILTER = "DATABASE STATS"
|
||||
"DATABASE PROPERTIES"
|
||||
"BACKUP DATABASE"
|
||||
"""
|
||||
|
||||
trace_1 = ['log_services = true',
|
||||
trace = ['log_services = true',
|
||||
'exclude_filter = "Database Stats"',
|
||||
]
|
||||
|
||||
temp_file_1 = temp_file('test-file')
|
||||
temp_file = temp_file('test-file')
|
||||
|
||||
@pytest.mark.version('>=3.0')
|
||||
def test_1(act_1: Action, temp_file_1):
|
||||
with act_1.trace(svc_events=trace_1), act_1.connect_server() as srv:
|
||||
srv.database.set_sweep_interval(database=act_1.db.db_path, interval=1234321)
|
||||
srv.database.get_statistics(database=act_1.db.db_path, flags=SrvStatFlag.HDR_PAGES)
|
||||
def test_1(act: Action, temp_file):
|
||||
with act.trace(svc_events=trace), act.connect_server() as srv:
|
||||
srv.database.set_sweep_interval(database=act.db.db_path, interval=1234321)
|
||||
srv.database.get_statistics(database=act.db.db_path, flags=SrvStatFlag.HDR_PAGES)
|
||||
srv.wait()
|
||||
srv.database.backup(database=act_1.db.db_path, backup=temp_file_1)
|
||||
srv.database.backup(database=act.db.db_path, backup=temp_file)
|
||||
srv.wait()
|
||||
act_1.expected_stdout = expected_stdout_1
|
||||
act_1.trace_to_stdout(upper=True)
|
||||
assert act_1.clean_stdout == act_1.clean_expected_stdout
|
||||
act.expected_stdout = expected_stdout
|
||||
act.trace_to_stdout(upper=True)
|
||||
assert act.clean_stdout == act.clean_expected_stdout
|
||||
|
@ -1,26 +1,21 @@
|
||||
#coding:utf-8
|
||||
#
|
||||
# id: bugs.core_3173
|
||||
# title: Empty result when select from SP that contains two CTE (second of them with GROUP BY clause) and INNER join
|
||||
# decription:
|
||||
# tracker_id: CORE-3173
|
||||
# min_versions: ['2.5.1']
|
||||
# versions: 2.5.1
|
||||
# qmid: None
|
||||
|
||||
"""
|
||||
ID: issue-3547
|
||||
ISSUE: 3547
|
||||
TITLE: Empty result when select from SP that contains two CTE (second of them with GROUP BY clause) and INNER join
|
||||
DESCRIPTION:
|
||||
JIRA: CORE-3173
|
||||
"""
|
||||
|
||||
import pytest
|
||||
from firebird.qa import db_factory, isql_act, Action
|
||||
from firebird.qa import *
|
||||
|
||||
# version: 2.5.1
|
||||
# resources: None
|
||||
|
||||
substitutions_1 = []
|
||||
|
||||
init_script_1 = """
|
||||
init_script = """
|
||||
create or alter procedure sp_main as begin end;
|
||||
create or alter procedure sp_aux1 as begin end;
|
||||
commit;
|
||||
|
||||
|
||||
recreate table zzz_tbl (
|
||||
id integer,
|
||||
company_id integer,
|
||||
@ -29,7 +24,7 @@ init_script_1 = """
|
||||
insert into zzz_tbl (id, company_id, hire_date)
|
||||
values (123456, 654321, '01.10.2004');
|
||||
commit;
|
||||
|
||||
|
||||
set term ^;
|
||||
create or alter procedure sp_aux1 returns (val integer)
|
||||
as begin
|
||||
@ -38,7 +33,7 @@ init_script_1 = """
|
||||
end
|
||||
^
|
||||
commit ^
|
||||
|
||||
|
||||
create or alter procedure sp_main (
|
||||
COMPANY_ID integer,
|
||||
A_MONTH_BEG date)
|
||||
@ -61,7 +56,7 @@ init_script_1 = """
|
||||
sp_aux1
|
||||
)t
|
||||
)
|
||||
|
||||
|
||||
,person_nfo as
|
||||
(
|
||||
select n.id person_id,i.p2
|
||||
@ -69,35 +64,35 @@ init_script_1 = """
|
||||
from zzz_tbl n left join inp i on n.company_id = i.company_id
|
||||
group by n.id,p2
|
||||
)
|
||||
|
||||
|
||||
select f.person_id
|
||||
from person_nfo f
|
||||
join zzz_tbl nt on nt.hire_date <= f.p2
|
||||
into :person_id
|
||||
do suspend;
|
||||
end
|
||||
|
||||
|
||||
^ 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 = """
|
||||
test_script = """
|
||||
set list on;
|
||||
select * from sp_main(654321, '01.09.2010');
|
||||
"""
|
||||
|
||||
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
|
||||
act = isql_act('db', test_script)
|
||||
|
||||
expected_stdout_1 = """
|
||||
expected_stdout = """
|
||||
PERSON_ID 123456
|
||||
"""
|
||||
|
||||
@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,22 +1,17 @@
|
||||
#coding:utf-8
|
||||
#
|
||||
# id: bugs.core_3174
|
||||
# title: Expression index with TRIM may lead to incorrect indexed lookup
|
||||
# decription:
|
||||
# tracker_id: CORE-3174
|
||||
# min_versions: ['3.0']
|
||||
# versions: 3.0
|
||||
# qmid: None
|
||||
|
||||
"""
|
||||
ID: issue-3548
|
||||
ISSUE: 3548
|
||||
TITLE: Expression index with TRIM may lead to incorrect indexed lookup
|
||||
DESCRIPTION:
|
||||
JIRA: CORE-3174
|
||||
"""
|
||||
|
||||
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 = """
|
||||
create collation ps_yes for utf8 from unicode pad space;
|
||||
create collation ps_no for utf8 from unicode no pad;
|
||||
|
||||
@ -35,9 +30,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 plan on;
|
||||
--set echo on;
|
||||
|
||||
@ -58,106 +53,106 @@ test_script_1 = """
|
||||
select '2.g' as test_no, id,'.' || c_nopad || '.' as c_nopad from t where trim(leading from c_nopad) starting with '123';
|
||||
"""
|
||||
|
||||
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
|
||||
act = isql_act('db', test_script, substitutions=[('=.*', '')])
|
||||
|
||||
expected_stdout_1 = """
|
||||
expected_stdout = """
|
||||
PLAN (T NATURAL)
|
||||
|
||||
|
||||
TEST_NO ID C_PAD
|
||||
======= ============ ============
|
||||
1.a 1 .123.
|
||||
1.a 2 . 123.
|
||||
1.a 3 .123 .
|
||||
1.a 4 . 123 .
|
||||
|
||||
|
||||
|
||||
|
||||
PLAN (T NATURAL)
|
||||
|
||||
|
||||
TEST_NO ID C_PAD
|
||||
======= ============ ============
|
||||
1.b 1 .123.
|
||||
1.b 3 .123 .
|
||||
|
||||
|
||||
|
||||
|
||||
PLAN (T INDEX (T_C_PAD_TRIM_RIGHT))
|
||||
|
||||
|
||||
TEST_NO ID C_PAD
|
||||
======= ============ ============
|
||||
1.c 1 .123.
|
||||
1.c 3 .123 .
|
||||
|
||||
|
||||
|
||||
|
||||
PLAN (T INDEX (T_C_PAD_TRIM_LEFT))
|
||||
|
||||
|
||||
TEST_NO ID C_PAD
|
||||
======= ============ ============
|
||||
1.d 1 .123.
|
||||
1.d 2 . 123.
|
||||
1.d 3 .123 .
|
||||
1.d 4 . 123 .
|
||||
|
||||
|
||||
|
||||
|
||||
PLAN (T INDEX (T_C_PAD_TRIM_RIGHT))
|
||||
|
||||
|
||||
TEST_NO ID C_PAD
|
||||
======= ============ ============
|
||||
1.e 1 .123.
|
||||
1.e 3 .123 .
|
||||
|
||||
|
||||
|
||||
|
||||
PLAN (T INDEX (T_C_PAD_TRIM_LEFT))
|
||||
|
||||
|
||||
TEST_NO ID C_PAD
|
||||
======= ============ ============
|
||||
1.f 1 .123.
|
||||
1.f 2 . 123.
|
||||
1.f 3 .123 .
|
||||
1.f 4 . 123 .
|
||||
|
||||
|
||||
|
||||
|
||||
PLAN (T NATURAL)
|
||||
|
||||
|
||||
TEST_NO ID C_NOPAD
|
||||
======= ============ ================================================
|
||||
2.a 1 .123.
|
||||
2.a 2 . 123.
|
||||
2.a 3 .123 .
|
||||
2.a 4 . 123 .
|
||||
|
||||
|
||||
|
||||
|
||||
PLAN (T NATURAL)
|
||||
|
||||
|
||||
TEST_NO ID C_NOPAD
|
||||
======= ============ ================================================
|
||||
2.b 1 .123.
|
||||
|
||||
|
||||
|
||||
|
||||
PLAN (T INDEX (T_C_NOPAD_TRIM_RIGHT))
|
||||
|
||||
|
||||
TEST_NO ID C_NOPAD
|
||||
======= ============ ================================================
|
||||
2.c 1 .123.
|
||||
2.c 3 .123 .
|
||||
|
||||
|
||||
|
||||
|
||||
PLAN (T INDEX (T_C_NOPAD_TRIM_LEFT))
|
||||
|
||||
|
||||
TEST_NO ID C_NOPAD
|
||||
======= ============ ================================================
|
||||
2.d 1 .123.
|
||||
2.d 2 . 123.
|
||||
|
||||
|
||||
|
||||
|
||||
PLAN (T INDEX (T_C_NOPAD_TRIM_RIGHT))
|
||||
|
||||
|
||||
TEST_NO ID C_NOPAD
|
||||
======= ============ ================================================
|
||||
2.f 1 .123.
|
||||
2.f 3 .123 .
|
||||
|
||||
|
||||
|
||||
|
||||
PLAN (T INDEX (T_C_NOPAD_TRIM_LEFT))
|
||||
|
||||
|
||||
TEST_NO ID C_NOPAD
|
||||
======= ============ ================================================
|
||||
2.g 1 .123.
|
||||
@ -167,8 +162,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_3176
|
||||
# title: View with "subselect" column join table and not use index
|
||||
# decription:
|
||||
# tracker_id: CORE-3176
|
||||
# min_versions: ['2.5.1']
|
||||
# versions: 2.5.1
|
||||
# qmid: None
|
||||
|
||||
"""
|
||||
ID: issue-3550
|
||||
ISSUE: 3550
|
||||
TITLE: View with "subselect" column join table and not use index
|
||||
DESCRIPTION:
|
||||
JIRA: CORE-3176
|
||||
"""
|
||||
|
||||
import pytest
|
||||
from firebird.qa import db_factory, isql_act, Action
|
||||
from firebird.qa import *
|
||||
|
||||
# version: 2.5.1
|
||||
# resources: None
|
||||
|
||||
substitutions_1 = []
|
||||
|
||||
init_script_1 = """CREATE TABLE TMP
|
||||
init_script = """CREATE TABLE TMP
|
||||
(
|
||||
ID Integer NOT NULL,
|
||||
CONSTRAINT PK_TMP_1 PRIMARY KEY (ID)
|
||||
@ -27,16 +22,15 @@ AS
|
||||
SELECT 1,(SELECT 1 FROM RDB$DATABASE) FROM RDB$DATABASE;
|
||||
COMMIT;"""
|
||||
|
||||
db_1 = db_factory(page_size=4096, 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 tmp_view TV LEFT JOIN tmp T ON T.id=TV.id2;
|
||||
"""
|
||||
|
||||
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_3176.fdb, User: SYSDBA
|
||||
SQL> SQL>
|
||||
expected_stdout = """
|
||||
PLAN (TV RDB$DATABASE NATURAL)
|
||||
PLAN (TV RDB$DATABASE NATURAL)
|
||||
PLAN JOIN (TV RDB$DATABASE NATURAL, T INDEX (PK_TMP_1))
|
||||
@ -44,12 +38,11 @@ PLAN JOIN (TV RDB$DATABASE NATURAL, T INDEX (PK_TMP_1))
|
||||
ID1 ID2 ID
|
||||
============ ============ ============
|
||||
1 1 <null>
|
||||
"""
|
||||
|
||||
SQL>"""
|
||||
|
||||
@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,43 +1,35 @@
|
||||
#coding:utf-8
|
||||
#
|
||||
# id: bugs.core_3180
|
||||
# title: ALTER VIEW with not matched columns in declaration and selection crashs the server
|
||||
# decription:
|
||||
# tracker_id: CORE-3180
|
||||
# min_versions: ['2.5.1']
|
||||
# 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 = """create view TEST_VIEW (ID) as select 1 from rdb$database;
|
||||
commit;"""
|
||||
|
||||
db_1 = db_factory(page_size=4096, sql_dialect=3, init=init_script_1)
|
||||
|
||||
test_script_1 = """alter view TEST_VIEW (ID) as select 1, 2 from rdb$database;
|
||||
COMMIT;
|
||||
SHOW VIEW TEST_VIEW;
|
||||
|
||||
|
||||
|
||||
"""
|
||||
ID: issue-3554
|
||||
ISSUE: 3554
|
||||
TITLE: ALTER VIEW with not matched columns in declaration and selection crashs the server
|
||||
DESCRIPTION:
|
||||
JIRA: CORE-3180
|
||||
"""
|
||||
|
||||
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
|
||||
import pytest
|
||||
from firebird.qa import *
|
||||
|
||||
expected_stdout_1 = """Database: localhost:C:\\fbt-repository\\tmp\\bugs.core_3180.fdb, User: SYSDBA
|
||||
SQL> SQL> SQL> ID INTEGER Expression
|
||||
init_script = """create view TEST_VIEW (ID) as select 1 from rdb$database;
|
||||
commit;"""
|
||||
|
||||
db = db_factory(init=init_script)
|
||||
|
||||
test_script = """alter view TEST_VIEW (ID) as select 1, 2 from rdb$database;
|
||||
COMMIT;
|
||||
SHOW VIEW TEST_VIEW;
|
||||
"""
|
||||
|
||||
act = isql_act('db', test_script)
|
||||
|
||||
expected_stdout = """ID INTEGER Expression
|
||||
View Source:
|
||||
==== ======
|
||||
select 1 from rdb$database
|
||||
SQL> SQL> SQL> SQL>"""
|
||||
expected_stderr_1 = """Statement failed, SQLSTATE = 07002
|
||||
"""
|
||||
|
||||
expected_stderr = """Statement failed, SQLSTATE = 07002
|
||||
unsuccessful metadata update
|
||||
-ALTER VIEW TEST_VIEW failed
|
||||
-SQL error code = -607
|
||||
@ -46,10 +38,10 @@ unsuccessful metadata update
|
||||
"""
|
||||
|
||||
@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_stderr == act_1.clean_expected_stderr
|
||||
assert act_1.clean_stdout == act_1.clean_expected_stdout
|
||||
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,172 +1,27 @@
|
||||
#coding:utf-8
|
||||
#
|
||||
# id: bugs.core_3188
|
||||
# title: page 0 is of wrong type (expected 6, found 1)
|
||||
# decription:
|
||||
# Confirmed on WI-V2.5.0.26074
|
||||
# exception:
|
||||
# DatabaseError:
|
||||
# Error while commiting transaction:
|
||||
# - SQLCODE: -902
|
||||
# - database file appears corrupt (C:\\MIX\\FIREBIRD\\QA\\FBT-REPO\\TMP\\BUGS.CORE_3188.FDB)
|
||||
# - wrong page type
|
||||
# - page 0 is of wrong type (expected 6, found 1)
|
||||
# -902
|
||||
# 335544335
|
||||
#
|
||||
# New messages in firebird.log in 2.5.0 after running ticket statements:
|
||||
#
|
||||
# CSPROG (Client) Mon Feb 15 07:28:05 2016
|
||||
# INET/inet_error: connect errno = 10061
|
||||
# CSPROG Mon Feb 15 07:41:02 2016
|
||||
# Shutting down the server with 0 active connection(s) to 0 database(s), 1 active service(s)
|
||||
#
|
||||
# tracker_id: CORE-3188
|
||||
# min_versions: ['2.5.1']
|
||||
# versions: 2.5.1
|
||||
# qmid: None
|
||||
|
||||
"""
|
||||
ID: issue-3562
|
||||
ISSUE: 3562
|
||||
TITLE: page 0 is of wrong type (expected 6, found 1)
|
||||
DESCRIPTION:
|
||||
JIRA: CORE-3188
|
||||
"""
|
||||
|
||||
import pytest
|
||||
from difflib import unified_diff
|
||||
from firebird.qa import db_factory, python_act, Action
|
||||
from firebird.qa import *
|
||||
|
||||
# version: 2.5.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
|
||||
#---
|
||||
#
|
||||
# import os
|
||||
# import difflib
|
||||
#
|
||||
# os.environ["ISC_USER"] = user_name
|
||||
# os.environ["ISC_PASSWORD"] = user_password
|
||||
#
|
||||
# engine = str(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'):
|
||||
# # 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] )
|
||||
# if os.path.isfile( f_names_list[i]):
|
||||
# print('ERROR: can not remove file ' + f_names_list[i])
|
||||
#
|
||||
# #--------------------------------------------
|
||||
#
|
||||
# def svc_get_fb_log( engine, f_fb_log ):
|
||||
#
|
||||
# import subprocess
|
||||
#
|
||||
# # ::: NB ::: Service call for receive firebird.log works properly only since FB 2.5.2!
|
||||
#
|
||||
# if engine.startswith('2.5'):
|
||||
# get_firebird_log_key='action_get_ib_log'
|
||||
# else:
|
||||
# get_firebird_log_key='action_get_fb_log'
|
||||
#
|
||||
# subprocess.call([ context['fbsvcmgr_path'],
|
||||
# "localhost:service_mgr",
|
||||
# get_firebird_log_key
|
||||
# ],
|
||||
# stdout=f_fb_log, stderr=subprocess.STDOUT
|
||||
# )
|
||||
# return
|
||||
#
|
||||
# #--------------------------------------------
|
||||
#
|
||||
#
|
||||
# # Start two attachments:
|
||||
# con1 = kdb.connect(dsn=dsn)
|
||||
# con2 = kdb.connect(dsn=dsn)
|
||||
#
|
||||
# # Session-1:
|
||||
# c1 = con1.cursor()
|
||||
#
|
||||
#
|
||||
# f_fblog_before=open( os.path.join(context['temp_directory'],'tmp_3188_fblog_before.txt'), 'w')
|
||||
# svc_get_fb_log( engine, f_fblog_before )
|
||||
# flush_and_close( f_fblog_before )
|
||||
#
|
||||
# c1.execute("create table test(id int primary key)")
|
||||
# con1.commit()
|
||||
#
|
||||
# # Session-2:
|
||||
#
|
||||
# c2 = con2.cursor()
|
||||
# c2.execute('drop table test')
|
||||
# con2.commit()
|
||||
#
|
||||
# # cleanup
|
||||
# con1.close()
|
||||
# con2.close()
|
||||
#
|
||||
# f_fblog_after=open( os.path.join(context['temp_directory'],'tmp_3188_fblog_after.txt'), 'w')
|
||||
# svc_get_fb_log( engine, f_fblog_after )
|
||||
# flush_and_close( f_fblog_after )
|
||||
#
|
||||
# # Now we can compare two versions of firebird.log and check their difference.
|
||||
#
|
||||
# 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_3188_diff.txt'), 'w')
|
||||
# f_diff_txt.write(difftext)
|
||||
# flush_and_close( f_diff_txt )
|
||||
#
|
||||
# # Difference of firebird.log should be EMPTY:
|
||||
#
|
||||
# with open( f_diff_txt.name,'r') as f:
|
||||
# print( f.read() )
|
||||
# f.close()
|
||||
#
|
||||
# ###############################
|
||||
# # Cleanup.
|
||||
# cleanup( [i.name for i in (f_fblog_before, f_fblog_after, f_diff_txt)] )
|
||||
#
|
||||
#
|
||||
#---
|
||||
|
||||
act_1 = python_act('db_1', substitutions=substitutions_1)
|
||||
|
||||
@pytest.mark.version('>=2.5.1')
|
||||
def test_1(act_1: Action):
|
||||
with act_1.connect_server() as srv:
|
||||
@pytest.mark.version('>=3')
|
||||
def test_1(act: Action):
|
||||
with act.connect_server() as srv:
|
||||
srv.info.get_log()
|
||||
log_before = srv.readlines()
|
||||
with act_1.db.connect() as con1, act_1.db.connect() as con2:
|
||||
with act.db.connect() as con1, act.db.connect() as con2:
|
||||
c1 = con1.cursor()
|
||||
c1.execute("create table test(id int primary key)")
|
||||
con1.commit()
|
||||
@ -176,4 +31,4 @@ def test_1(act_1: Action):
|
||||
con2.commit()
|
||||
srv.info.get_log()
|
||||
log_after = srv.readlines()
|
||||
assert list(unified_diff(log_before, log_after)) == []
|
||||
assert list(unified_diff(log_before, log_after)) == []
|
||||
|
@ -1,41 +1,34 @@
|
||||
#coding:utf-8
|
||||
#
|
||||
# id: bugs.core_3201
|
||||
# title: ATAN2 returns incorrect value for (0, 0)
|
||||
# decription:
|
||||
# tracker_id: CORE-3201
|
||||
# min_versions: ['3.0']
|
||||
# versions: 3.0
|
||||
# qmid: None
|
||||
|
||||
"""
|
||||
ID: issue-3575
|
||||
ISSUE: 3575
|
||||
TITLE: ATAN2 returns incorrect value for (0, 0)
|
||||
DESCRIPTION:
|
||||
JIRA: CORE-3201
|
||||
"""
|
||||
|
||||
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 = """
|
||||
set list on;
|
||||
select ATAN2(0, 0) undef_atan from rdb$database;
|
||||
"""
|
||||
|
||||
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
|
||||
expression evaluation not supported
|
||||
-Arguments for ATAN2 cannot both be zero
|
||||
"""
|
||||
|
||||
@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_3204
|
||||
# title: Constraint violation error of CAST is not raised inside views
|
||||
# decription:
|
||||
# tracker_id: CORE-3204
|
||||
# min_versions: ['3.0']
|
||||
# versions: 3.0
|
||||
# qmid: None
|
||||
|
||||
"""
|
||||
ID: issue-3578
|
||||
ISSUE: 3578
|
||||
TITLE: Constraint violation error of CAST is not raised inside views
|
||||
DESCRIPTION:
|
||||
JIRA: CORE-3204
|
||||
"""
|
||||
|
||||
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 or alter view v1 as select 1 id from rdb$database;
|
||||
commit;
|
||||
set term ^;
|
||||
@ -32,25 +25,25 @@ test_script_1 = """
|
||||
^
|
||||
set term ;^
|
||||
commit;
|
||||
|
||||
|
||||
create domain d1 integer not null;
|
||||
commit;
|
||||
|
||||
|
||||
set list on;
|
||||
|
||||
|
||||
select cast(null as d1) from rdb$database; -- error: ok
|
||||
commit;
|
||||
|
||||
|
||||
create or alter view v1 as select cast(null as d1) x from rdb$database;
|
||||
commit;
|
||||
|
||||
select * from v1;
|
||||
|
||||
select * from v1;
|
||||
|
||||
"""
|
||||
|
||||
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
|
||||
validation error for CAST, value "*** null ***"
|
||||
Statement failed, SQLSTATE = 42000
|
||||
@ -58,8 +51,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_3210
|
||||
# title: The cursor identified in the UPDATE or DELETE statement is not positioned on a row. no current record for fetch operation in SELECT query
|
||||
# decription:
|
||||
# tracker_id: CORE-3210
|
||||
# min_versions: ['2.5.1']
|
||||
# versions: 2.5.1
|
||||
# qmid: None
|
||||
|
||||
"""
|
||||
ID: issue-3584
|
||||
ISSUE: 3584
|
||||
TITLE: The cursor identified in the UPDATE or DELETE statement is not positioned on a row. no current record for fetch operation in SELECT query
|
||||
DESCRIPTION:
|
||||
JIRA: CORE-3210
|
||||
"""
|
||||
|
||||
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='core3210.fbk')
|
||||
|
||||
substitutions_1 = []
|
||||
|
||||
init_script_1 = """"""
|
||||
|
||||
db_1 = db_factory(from_backup='core3210.fbk', init=init_script_1)
|
||||
|
||||
test_script_1 = """
|
||||
test_script = """
|
||||
set list on;
|
||||
select count(*) cnt
|
||||
from (
|
||||
@ -42,15 +35,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 171
|
||||
"""
|
||||
|
||||
@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,22 +1,17 @@
|
||||
#coding:utf-8
|
||||
#
|
||||
# id: bugs.core_3211
|
||||
# title: String truncation occurs when selecting from a view containing NOT IN inside
|
||||
# decription:
|
||||
# tracker_id: CORE-3211
|
||||
# min_versions: ['2.5.1']
|
||||
# versions: 2.5.1
|
||||
# qmid: None
|
||||
|
||||
"""
|
||||
ID: issue-3585
|
||||
ISSUE: 3585
|
||||
TITLE: String truncation occurs when selecting from a view containing NOT IN inside
|
||||
DESCRIPTION:
|
||||
JIRA: CORE-3211
|
||||
"""
|
||||
|
||||
import pytest
|
||||
from firebird.qa import db_factory, isql_act, Action
|
||||
from firebird.qa import *
|
||||
|
||||
# version: 2.5.1
|
||||
# resources: None
|
||||
|
||||
substitutions_1 = []
|
||||
|
||||
init_script_1 = """CREATE TABLE T ( ID integer, FIELD1 varchar(30) );
|
||||
init_script = """CREATE TABLE T ( ID integer, FIELD1 varchar(30) );
|
||||
COMMIT;
|
||||
CREATE VIEW VT ( ID )
|
||||
AS
|
||||
@ -30,14 +25,11 @@ INSERT INTO T (ID, FIELD1) VALUES (4, 'system');
|
||||
INSERT INTO T (ID, FIELD1) VALUES (5, 'system');
|
||||
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 * from VT;"""
|
||||
act = isql_act('db', "select * from VT;")
|
||||
|
||||
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
|
||||
|
||||
expected_stdout_1 = """Database: localhost:C:\\Users\\win7\\Firebird_tests\\fbt-repository\\tmp\\bugs.core_3211.fdb, User: SYSDBA
|
||||
SQL>
|
||||
expected_stdout = """
|
||||
ID
|
||||
============
|
||||
1
|
||||
@ -45,12 +37,11 @@ SQL>
|
||||
3
|
||||
4
|
||||
5
|
||||
"""
|
||||
|
||||
SQL>"""
|
||||
|
||||
@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,31 +1,26 @@
|
||||
#coding:utf-8
|
||||
#
|
||||
# id: bugs.core_3222
|
||||
# title: View with "WITH CHECK OPTION" doesn't like TRIM function in WHERE
|
||||
# decription:
|
||||
# tracker_id: CORE-3222
|
||||
# min_versions: ['2.5.1']
|
||||
# versions: 2.5.1
|
||||
# qmid: None
|
||||
|
||||
"""
|
||||
ID: issue-3596
|
||||
ISSUE: 3596
|
||||
TITLE: View with "WITH CHECK OPTION" doesn't like TRIM function in WHERE
|
||||
DESCRIPTION:
|
||||
JIRA: CORE-3222
|
||||
"""
|
||||
|
||||
import pytest
|
||||
from firebird.qa import db_factory, isql_act, Action
|
||||
from firebird.qa import *
|
||||
|
||||
# version: 2.5.1
|
||||
# resources: None
|
||||
|
||||
substitutions_1 = []
|
||||
|
||||
init_script_1 = """CREATE TABLE Foo (
|
||||
init_script = """CREATE TABLE Foo (
|
||||
Bar INTEGER,
|
||||
Str CHAR(31)
|
||||
);
|
||||
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 VIEW VIEW_Foo (
|
||||
test_script = """CREATE VIEW VIEW_Foo (
|
||||
Bar
|
||||
) AS SELECT
|
||||
Bar
|
||||
@ -37,10 +32,9 @@ COMMIT;
|
||||
SHOW VIEW VIEW_Foo;
|
||||
"""
|
||||
|
||||
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_3222.fdb, User: SYSDBA
|
||||
SQL> CON> CON> CON> CON> CON> CON> CON> SQL> SQL> BAR INTEGER Nullable
|
||||
expected_stdout = """BAR INTEGER Nullable
|
||||
View Source:
|
||||
==== ======
|
||||
SELECT
|
||||
@ -48,11 +42,11 @@ View Source:
|
||||
FROM Foo
|
||||
WHERE(Trim(Str) = 'test')
|
||||
WITH CHECK OPTION
|
||||
SQL>"""
|
||||
"""
|
||||
|
||||
@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,32 +1,25 @@
|
||||
#coding:utf-8
|
||||
#
|
||||
# id: bugs.core_3227
|
||||
# title: ASCII_VAL() fails if argument contains multi-byte character anywhere
|
||||
# decription:
|
||||
# tracker_id: CORE-3227
|
||||
# min_versions: ['2.1.4']
|
||||
# versions: 2.1.4
|
||||
# qmid: None
|
||||
|
||||
"""
|
||||
ID: issue-3601
|
||||
ISSUE: 3601
|
||||
TITLE: ASCII_VAL() fails if argument contains multi-byte character anywhere
|
||||
DESCRIPTION:
|
||||
JIRA: CORE-3227
|
||||
"""
|
||||
|
||||
import pytest
|
||||
from firebird.qa import db_factory, isql_act, Action
|
||||
from firebird.qa import *
|
||||
|
||||
# version: 2.1.4
|
||||
# resources: None
|
||||
db = db_factory(charset='UTF8')
|
||||
|
||||
substitutions_1 = []
|
||||
|
||||
init_script_1 = """"""
|
||||
|
||||
db_1 = db_factory(page_size=4096, charset='UTF8', sql_dialect=3, init=init_script_1)
|
||||
|
||||
test_script_1 = """select ascii_val (cast('Hoplala' as char(12) character set utf8)) from rdb$database;
|
||||
test_script = """select ascii_val (cast('Hoplala' as char(12) character set utf8)) from rdb$database;
|
||||
select ascii_val (cast('Hopläla' as char(12) character set utf8)) 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 = """
|
||||
ASCII_VAL
|
||||
=========
|
||||
72
|
||||
@ -38,9 +31,9 @@ ASCII_VAL
|
||||
|
||||
"""
|
||||
|
||||
@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,26 +1,19 @@
|
||||
#coding:utf-8
|
||||
#
|
||||
# id: bugs.core_3228
|
||||
# title: RIGHT() fails with multibyte text blobs > 1024 chars
|
||||
# decription:
|
||||
# tracker_id: CORE-3228
|
||||
# min_versions: ['2.1.4']
|
||||
# versions: 2.1.4
|
||||
# qmid: None
|
||||
|
||||
"""
|
||||
ID: issue-1283
|
||||
ISSUE: 1283
|
||||
TITLE: RIGHT() fails with multibyte text blobs > 1024 chars
|
||||
DESCRIPTION:
|
||||
JIRA: CORE-3228
|
||||
"""
|
||||
|
||||
import pytest
|
||||
from firebird.qa import db_factory, isql_act, Action
|
||||
from firebird.qa import *
|
||||
|
||||
# version: 2.1.4
|
||||
# resources: None
|
||||
db = db_factory(charset='UTF8')
|
||||
|
||||
substitutions_1 = []
|
||||
|
||||
init_script_1 = """"""
|
||||
|
||||
db_1 = db_factory(page_size=4096, charset='UTF8', sql_dialect=3, init=init_script_1)
|
||||
|
||||
test_script_1 = """with q (s) as (
|
||||
test_script = """with q (s) as (
|
||||
select
|
||||
cast(
|
||||
cast('AAA' as char(1021)) || 'ZZZ'
|
||||
@ -39,10 +32,9 @@ with q (s) as (
|
||||
)
|
||||
select right(s, 3) from q;"""
|
||||
|
||||
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_3228.fdb, User: SYSDBA
|
||||
SQL> CON> CON> CON> CON> CON> CON> CON> CON>
|
||||
expected_stdout = """
|
||||
RIGHT
|
||||
=================
|
||||
0:3
|
||||
@ -51,7 +43,6 @@ RIGHT:
|
||||
ZZZ
|
||||
==============================================================================
|
||||
|
||||
SQL> CON> CON> CON> CON> CON> CON> CON> CON>
|
||||
RIGHT
|
||||
=================
|
||||
0:8
|
||||
@ -59,12 +50,11 @@ SQL> CON> CON> CON> CON> CON> CON> CON> CON>
|
||||
RIGHT:
|
||||
ZZZ
|
||||
==============================================================================
|
||||
"""
|
||||
|
||||
SQL>"""
|
||||
|
||||
@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,59 +1,23 @@
|
||||
#coding:utf-8
|
||||
#
|
||||
# id: bugs.core_3231
|
||||
# title: OVERLAY() fails when used with text BLOBs containing multi-byte chars
|
||||
# decription:
|
||||
# tracker_id: CORE-3231
|
||||
# min_versions: ['2.1.5']
|
||||
# versions: 2.1.5
|
||||
# qmid: None
|
||||
|
||||
"""
|
||||
ID: issue-3604
|
||||
ISSUE: 3604
|
||||
TITLE: OVERLAY() fails when used with text BLOBs containing multi-byte chars
|
||||
DESCRIPTION:
|
||||
JIRA: CORE-3231
|
||||
"""
|
||||
|
||||
import pytest
|
||||
from firebird.qa import db_factory, python_act, Action
|
||||
from firebird.qa import *
|
||||
|
||||
# version: 2.1.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
|
||||
#---
|
||||
# c = db_conn.cursor()
|
||||
# try:
|
||||
# c.execute("with q(s) as (select cast('abcdefghijklmno' as blob sub_type 1 character set utf8) from rdb$database) select overlay (s placing cast('0123456789' as blob sub_type 1 character set utf8) from 5) from q")
|
||||
# c.fetchall()
|
||||
# except Exception,e:
|
||||
# print ("Test non multi-bytes Failed")
|
||||
# print (e)
|
||||
# else:
|
||||
# pass
|
||||
# try:
|
||||
# c.execute("with q(s) as (select cast('abcdefghijklmno' as blob sub_type 1 character set utf8) from rdb$database) select overlay (s placing cast(_iso8859_1 'áé' as blob sub_type 1 character set utf8) from 5) from q")
|
||||
# c.fetchall()
|
||||
# except Exception,e:
|
||||
# print ("Test utf8 Failed")
|
||||
# print (e)
|
||||
# else:
|
||||
# pass
|
||||
# try:
|
||||
# c.execute("with q(s) as (select cast('abcdefghijklmno' as blob sub_type 1 character set utf8) from rdb$database) select overlay (s placing cast(_iso8859_1 'áé' as blob sub_type 1 character set iso8859_1) from 5) from q")
|
||||
# c.fetchall()
|
||||
# except Exception,e:
|
||||
# print ("Test iso8859_1 Failed")
|
||||
# print (e)
|
||||
# else:
|
||||
# pass
|
||||
#---
|
||||
|
||||
act_1 = python_act('db_1', substitutions=substitutions_1)
|
||||
act = python_act('db')
|
||||
|
||||
@pytest.mark.version('>=3.0')
|
||||
def test_1(act_1: Action):
|
||||
with act_1.db.connect() as con:
|
||||
def test_1(act: Action):
|
||||
with act.db.connect() as con:
|
||||
c = con.cursor()
|
||||
# Test non multi-bytes
|
||||
c.execute("with q(s) as (select cast('abcdefghijklmno' as blob sub_type 1 character set utf8) from rdb$database) select overlay (s placing cast('0123456789' as blob sub_type 1 character set utf8) from 5) from q")
|
||||
|
@ -1,50 +1,42 @@
|
||||
#coding:utf-8
|
||||
#
|
||||
# id: bugs.core_3233
|
||||
# title: LIKE, STARTING and CONTAINING fail if second operand >= 32K
|
||||
# decription:
|
||||
# tracker_id: CORE-3233
|
||||
# min_versions: ['2.1.5']
|
||||
# versions: 2.1.5
|
||||
# qmid: None
|
||||
|
||||
"""
|
||||
ID: issue-3605
|
||||
ISSUE: 3605
|
||||
TITLE: LIKE, STARTING and CONTAINING fail if second operand >= 32K
|
||||
DESCRIPTION:
|
||||
JIRA: CORE-3233
|
||||
"""
|
||||
|
||||
import pytest
|
||||
from firebird.qa import db_factory, isql_act, Action
|
||||
from firebird.qa import *
|
||||
|
||||
# version: 2.1.5
|
||||
# resources: None
|
||||
|
||||
substitutions_1 = []
|
||||
|
||||
init_script_1 = """create table blobz (zin blob sub_type 1);
|
||||
init_script = """create table blobz (zin blob sub_type 1);
|
||||
insert into blobz (zin) values ('woord');
|
||||
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 1 from blobz where zin like cast(cast('woord' as char(32766)) as blob sub_type 1) || '!' or zin='woord';
|
||||
test_script = """select 1 from blobz where zin like cast(cast('woord' as char(32766)) as blob sub_type 1) || '!' or zin='woord';
|
||||
select 1 from blobz where zin like cast(cast('woord' as char(32767)) as blob sub_type 1) || '!' or zin='woord';
|
||||
"""
|
||||
|
||||
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
|
||||
act = isql_act('db', test_script)
|
||||
|
||||
expected_stdout_1 = """Database: localhost:C:\\fbtestnew\\tmp\\bugs.core_3233.fdb, User: SYSDBA
|
||||
SQL>
|
||||
expected_stdout = """
|
||||
CONSTANT
|
||||
============
|
||||
1
|
||||
|
||||
SQL>
|
||||
CONSTANT
|
||||
============
|
||||
1
|
||||
"""
|
||||
|
||||
SQL>"""
|
||||
|
||||
@pytest.mark.version('>=2.1.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_3234
|
||||
# title: Support for text BLOBs >= 32K as first argument for TRIM()
|
||||
# decription:
|
||||
# tracker_id: CORE-3234
|
||||
# min_versions: ['3.0']
|
||||
# versions: 3.0
|
||||
# qmid: None
|
||||
|
||||
"""
|
||||
ID: issue-3606
|
||||
ISSUE: 3606
|
||||
TITLE: Support for text BLOBs >= 32K as first argument for TRIM()
|
||||
DESCRIPTION:
|
||||
JIRA: CORE-3234
|
||||
"""
|
||||
|
||||
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 = """
|
||||
-- For single-byte (ascii) charset this test was run also two blobs with length 50'000'000 (+3) bytes: result was OK.
|
||||
-- Current settings check work of TRIM() on blobs with non-ascii characters with octet_length ~ 1'000'000 bytes.
|
||||
-- Elapsed time on P-IV 3.0 GHz / RAM 2 Gb: ~7 second.
|
||||
@ -198,9 +191,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 = """
|
||||
B1_OCTET_LEN 1082024
|
||||
B2_OCTET_LEN 1082047
|
||||
TRIMMED_OCTET_LEN 23
|
||||
@ -210,8 +203,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(charset='utf8')
|
||||
assert act_1.clean_stdout == act_1.clean_expected_stdout
|
||||
def test_1(act: Action):
|
||||
act.expected_stdout = expected_stdout
|
||||
act.execute(charset='utf8')
|
||||
assert act.clean_stdout == act.clean_expected_stdout
|
||||
|
||||
|
@ -1,26 +1,19 @@
|
||||
#coding:utf-8
|
||||
#
|
||||
# id: bugs.core_3238
|
||||
# title: Makes GEN_UUID return a compliant RFC-4122 UUID
|
||||
# decription:
|
||||
# tracker_id: CORE-3238
|
||||
# min_versions: ['2.5.2']
|
||||
# versions: 2.5.2
|
||||
# qmid: None
|
||||
|
||||
"""
|
||||
ID: issue-3609
|
||||
ISSUE: 3609
|
||||
TITLE: Makes GEN_UUID return a compliant RFC-4122 UUID
|
||||
DESCRIPTION:
|
||||
JIRA: CORE-3238
|
||||
"""
|
||||
|
||||
import pytest
|
||||
from firebird.qa import db_factory, isql_act, Action
|
||||
from firebird.qa import *
|
||||
|
||||
# version: 2.5.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 = """
|
||||
test_script = """
|
||||
set list on;
|
||||
set term ^;
|
||||
execute block returns(err_cnt int) as
|
||||
@ -40,15 +33,15 @@ 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 = """
|
||||
ERR_CNT 0
|
||||
"""
|
||||
|
||||
@pytest.mark.version('>=2.5.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,27 +1,20 @@
|
||||
#coding:utf-8
|
||||
#
|
||||
# id: bugs.core_3239
|
||||
# title: UTF8 UNICODE_CI collate can not be used in compound index
|
||||
# decription:
|
||||
# tracker_id: CORE-3239
|
||||
# min_versions: ['3.0']
|
||||
# versions: 3.0
|
||||
# qmid: None
|
||||
|
||||
"""
|
||||
ID: issue-3610
|
||||
ISSUE: 3610
|
||||
TITLE: UTF8 UNICODE_CI collate can not be used in compound index
|
||||
DESCRIPTION:
|
||||
JIRA: CORE-3239
|
||||
"""
|
||||
|
||||
import pytest
|
||||
from firebird.qa import db_factory, isql_act, Action
|
||||
from firebird.qa import *
|
||||
|
||||
# version: 3.0
|
||||
# resources: None
|
||||
db = db_factory(charset='UTF8')
|
||||
|
||||
substitutions_1 = []
|
||||
|
||||
init_script_1 = """"""
|
||||
|
||||
db_1 = db_factory(charset='UTF8', sql_dialect=3, init=init_script_1)
|
||||
|
||||
test_script_1 = """
|
||||
create collation co_utf8_ci_ai for utf8 from unicode case insensitive accent insensitive;
|
||||
test_script = """
|
||||
create collation co_utf8_ci_ai for utf8 from unicode case insensitive accent insensitive;
|
||||
commit;
|
||||
|
||||
create table test (
|
||||
@ -35,7 +28,7 @@ test_script_1 = """
|
||||
);
|
||||
commit;
|
||||
|
||||
-- áéíóúý àèìòù âêîôû ãñõ äëïöüÿ çš δθλξσψω ąęłźż
|
||||
-- áéíóúý àèìòù âêîôû ãñõ äëïöüÿ çš δθλξσψω ąęłźż
|
||||
insert into test (rule_id, ci, ciai, bfield, pattern) values (1, 'âêîôû' , 'âÊîôû' , true , '_e_O%');
|
||||
insert into test (rule_id, ci, ciai, bfield, pattern) values (2, 'äëïöüÿ', 'Äëïöüÿ', false, '_e%ioU_');
|
||||
insert into test (rule_id, ci, ciai, bfield, pattern) values (3, 'áéíóúý', 'ÁéÍÓÚý', false, 'A__O_Y');
|
||||
@ -45,20 +38,20 @@ test_script_1 = """
|
||||
set list on;
|
||||
set plan on;
|
||||
--set echo on;
|
||||
|
||||
|
||||
select rule_id
|
||||
from test
|
||||
where bfield = false and ciai similar to pattern;
|
||||
|
||||
select rule_id
|
||||
from test
|
||||
where
|
||||
rule_id = 1
|
||||
|
||||
select rule_id
|
||||
from test
|
||||
where
|
||||
rule_id = 1
|
||||
and ci starting with 'ÂÊ'
|
||||
and ciai similar to '%EIOU%';
|
||||
|
||||
select rule_id from test
|
||||
where
|
||||
select rule_id from test
|
||||
where
|
||||
bfield = false
|
||||
and ciai similar to 'AEIOUY'
|
||||
and ci similar to '%ÄË%ÜŸ';
|
||||
@ -69,9 +62,9 @@ test_script_1 = """
|
||||
where a.bfield = true;
|
||||
"""
|
||||
|
||||
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 INDEX (TEST_BOOL_CIAI_CI))
|
||||
RULE_ID 2
|
||||
RULE_ID 3
|
||||
@ -88,8 +81,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,28 +1,19 @@
|
||||
#coding:utf-8
|
||||
#
|
||||
# id: bugs.core_3242
|
||||
# title: Recursive stored procedure shouldnt require execute right to call itself
|
||||
# decription:
|
||||
# Checked on: 4.0.0.1635: OK, 2.337s; 3.0.5.33180: OK, 2.497s.
|
||||
#
|
||||
# tracker_id: CORE-3242
|
||||
# min_versions: ['3.0']
|
||||
# versions: 3.0
|
||||
# qmid: None
|
||||
|
||||
"""
|
||||
ID: issue-3612
|
||||
ISSUE: 3612
|
||||
TITLE: Recursive stored procedure shouldnt require execute right to call itself
|
||||
DESCRIPTION:
|
||||
JIRA: CORE-3242
|
||||
"""
|
||||
|
||||
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 = """
|
||||
set wng off;
|
||||
set bail on;
|
||||
|
||||
@ -63,7 +54,7 @@ test_script_1 = """
|
||||
return i;
|
||||
end
|
||||
^
|
||||
|
||||
|
||||
create or alter procedure sp_factorial(i smallint) returns (o bigint) as
|
||||
begin
|
||||
for select o from sp_recur( :i ) into o do suspend;
|
||||
@ -109,11 +100,11 @@ test_script_1 = """
|
||||
|
||||
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
|
||||
revoke all on all from tmp$c3242;
|
||||
commit;
|
||||
|
||||
grant execute on function fn_factorial to tmp$c3242;
|
||||
grant execute on function fn_factorial to tmp$c3242;
|
||||
grant execute on procedure sp_factorial to tmp$c3242;
|
||||
grant execute on package pg_factorial to tmp$c3242;
|
||||
|
||||
@ -138,9 +129,9 @@ test_script_1 = """
|
||||
commit;
|
||||
"""
|
||||
|
||||
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
|
||||
act = isql_act('db', test_script)
|
||||
|
||||
expected_stdout_1 = """
|
||||
expected_stdout = """
|
||||
STANDALONE_SP_RESULT 120
|
||||
STANDALONE_FN_RESULT 5040
|
||||
PACKAGED_SP_RESULT 362880
|
||||
@ -148,8 +139,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,52 +1,41 @@
|
||||
#coding:utf-8
|
||||
#
|
||||
# id: bugs.core_3244
|
||||
# title: POSITION: Wrong result with '' if third argument present
|
||||
# decription:
|
||||
# tracker_id: CORE-3244
|
||||
# min_versions: ['2.1.4']
|
||||
# versions: 2.1.4
|
||||
# qmid: None
|
||||
|
||||
"""
|
||||
ID: issue-3614
|
||||
ISSUE: 3614
|
||||
TITLE: POSITION: Wrong result with '' if third argument present
|
||||
DESCRIPTION:
|
||||
JIRA: CORE-3244
|
||||
"""
|
||||
|
||||
import pytest
|
||||
from firebird.qa import db_factory, isql_act, Action
|
||||
from firebird.qa import *
|
||||
|
||||
# version: 2.1.4
|
||||
# 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 ('', 'Broehaha') from rdb$database;
|
||||
test_script = """select position ('', 'Broehaha') from rdb$database;
|
||||
select position ('', 'Broehaha', 4) from rdb$database;
|
||||
select position ('', 'Broehaha', 20) 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_3244.fdb, User: SYSDBA
|
||||
SQL>
|
||||
expected_stdout = """
|
||||
POSITION
|
||||
============
|
||||
1
|
||||
|
||||
SQL>
|
||||
POSITION
|
||||
============
|
||||
4
|
||||
|
||||
SQL>
|
||||
POSITION
|
||||
============
|
||||
0
|
||||
"""
|
||||
|
||||
SQL>"""
|
||||
|
||||
@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,26 +1,19 @@
|
||||
#coding:utf-8
|
||||
#
|
||||
# id: bugs.core_3245
|
||||
# title: SUBSTRING on long blobs truncates result to 32767 if third argument not present
|
||||
# decription:
|
||||
# tracker_id: CORE-3245
|
||||
# min_versions: ['2.1.5']
|
||||
# versions: 2.1.5
|
||||
# qmid: None
|
||||
|
||||
"""
|
||||
ID: issue-3615
|
||||
ISSUE: 3615
|
||||
TITLE: SUBSTRING on long blobs truncates result to 32767 if third argument not present
|
||||
DESCRIPTION:
|
||||
JIRA: CORE-3245
|
||||
"""
|
||||
|
||||
import pytest
|
||||
from firebird.qa import db_factory, isql_act, Action
|
||||
from firebird.qa import *
|
||||
|
||||
# version: 2.1.5
|
||||
# resources: None
|
||||
db = db_factory()
|
||||
|
||||
substitutions_1 = [('blob_.*', '')]
|
||||
|
||||
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;
|
||||
with q (s) as (
|
||||
select cast(cast('abc' as char(32767)) as blob sub_type text)
|
||||
@ -45,9 +38,9 @@ test_script_1 = """
|
||||
;
|
||||
"""
|
||||
|
||||
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
|
||||
act = isql_act('db', test_script, substitutions=[('blob_.*', '')])
|
||||
|
||||
expected_stdout_1 = """
|
||||
expected_stdout = """
|
||||
char_length(s) 98305
|
||||
ail
|
||||
char_length(sub_for) 90306
|
||||
@ -56,9 +49,9 @@ expected_stdout_1 = """
|
||||
ail
|
||||
"""
|
||||
|
||||
@pytest.mark.version('>=2.1.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_3255
|
||||
# title: The server could crash using views with GROUP BY
|
||||
# decription:
|
||||
# tracker_id: CORE-3255
|
||||
# min_versions: ['2.5.1']
|
||||
# versions: 2.5.1
|
||||
# qmid: None
|
||||
|
||||
"""
|
||||
ID: issue-3623
|
||||
ISSUE: 3623
|
||||
TITLE: The server could crash using views with GROUP BY
|
||||
DESCRIPTION:
|
||||
JIRA: CORE-3255
|
||||
"""
|
||||
|
||||
import pytest
|
||||
from firebird.qa import db_factory, isql_act, Action
|
||||
from firebird.qa import *
|
||||
|
||||
# version: 2.5.1
|
||||
# resources: None
|
||||
|
||||
substitutions_1 = []
|
||||
|
||||
init_script_1 = """SET TERM !;
|
||||
init_script = """SET TERM !;
|
||||
create table t1 (
|
||||
n1 integer
|
||||
)!
|
||||
@ -56,34 +51,31 @@ commit!
|
||||
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 * from p2;
|
||||
test_script = """select * from p2;
|
||||
select * from p1;
|
||||
"""
|
||||
|
||||
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_3255.fdb, User: SYSDBA
|
||||
SQL>
|
||||
expected_stdout = """
|
||||
X N1
|
||||
====== ============
|
||||
a 1
|
||||
a 2
|
||||
a 3
|
||||
|
||||
SQL>
|
||||
X N1
|
||||
====== ============
|
||||
a 1
|
||||
a 2
|
||||
a 3
|
||||
"""
|
||||
|
||||
SQL>"""
|
||||
|
||||
@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,31 +1,24 @@
|
||||
#coding:utf-8
|
||||
#
|
||||
# id: bugs.core_3256
|
||||
# title: Error "request depth exceeded" may appear while preparing a select query against a view with explicit plan
|
||||
# decription:
|
||||
# tracker_id: CORE-3256
|
||||
# min_versions: ['2.5.1']
|
||||
# versions: 2.5.1
|
||||
# qmid: None
|
||||
|
||||
"""
|
||||
ID: issue-3624
|
||||
ISSUE: 3624
|
||||
TITLE: Error "request depth exceeded" may appear while preparing a select query against a view with explicit plan
|
||||
DESCRIPTION:
|
||||
JIRA: CORE-3256
|
||||
"""
|
||||
|
||||
import pytest
|
||||
from firebird.qa import db_factory, isql_act, Action
|
||||
from firebird.qa import *
|
||||
|
||||
# version: 2.5.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 = """
|
||||
create or alter view vt(id,name) as select 1 id, '' name from rdb$database;
|
||||
commit;
|
||||
|
||||
|
||||
recreate table t1 (id integer not null,name integer not null);
|
||||
alter table t1 add constraint pk_t1 primary key (id)
|
||||
alter table t1 add constraint pk_t1 primary key (id)
|
||||
using index pk_t1
|
||||
;
|
||||
create or alter view vt(id,name) as select * from t1;
|
||||
@ -173,7 +166,7 @@ test_script_1 = """
|
||||
select * from vt where id=1 PLAN (vt T1 INDEX (PK_T1));
|
||||
select * from vt where id=1 PLAN (vt T1 INDEX (PK_T1));
|
||||
select * from vt where id=1 PLAN (vt T1 INDEX (PK_T1));
|
||||
|
||||
|
||||
-- The following statement leads to:
|
||||
-- Statement failed, SQLSTATE = 54001
|
||||
-- unsuccessful metadata update
|
||||
@ -184,10 +177,11 @@ test_script_1 = """
|
||||
--#####################################################
|
||||
"""
|
||||
|
||||
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
|
||||
|
||||
|
||||
@pytest.mark.version('>=2.5.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,58 +1,51 @@
|
||||
#coding:utf-8
|
||||
#
|
||||
# id: bugs.core_3262
|
||||
# title: LIST() may overwrite last part of output with zero characters
|
||||
# decription:
|
||||
# tracker_id: CORE-3262
|
||||
# min_versions: ['2.1.4']
|
||||
# versions: 2.1.4
|
||||
# qmid: None
|
||||
|
||||
"""
|
||||
ID: issue-3630
|
||||
ISSUE: 3630
|
||||
TITLE: LIST() may overwrite last part of output with zero characters
|
||||
DESCRIPTION:
|
||||
JIRA: CORE-3262
|
||||
"""
|
||||
|
||||
import pytest
|
||||
from firebird.qa import db_factory, isql_act, Action
|
||||
from firebird.qa import *
|
||||
|
||||
# version: 2.1.4
|
||||
# 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 vc (s varchar(8000));
|
||||
commit;
|
||||
|
||||
|
||||
insert into vc values (cast('A' as char(4000)) || 'B');
|
||||
|
||||
|
||||
set list on;
|
||||
|
||||
|
||||
select char_length(s), position('A' in s), position('B' in s) from vc;
|
||||
|
||||
|
||||
with q (l) as (select list(s) from vc)
|
||||
select char_length(l), position('A' in l), position('B' in l) from q;
|
||||
|
||||
|
||||
|
||||
|
||||
update vc set s = (cast('A' as char(5000)) || 'B');
|
||||
|
||||
|
||||
select char_length(s), position('A' in s), position('B' in s) from vc;
|
||||
|
||||
|
||||
|
||||
|
||||
with q (l) as (select list(s) from vc)
|
||||
select char_length(l), position('A' in l), position('B' in l) from q;
|
||||
|
||||
|
||||
|
||||
|
||||
with q (l) as (select reverse(list(s)) from vc)
|
||||
select char_length(l), position('A' in l), position('B' in l) from q;
|
||||
|
||||
|
||||
with q (l) as (select list(s) from vc)
|
||||
select ascii_val(substring(l from 4066 for 1)), ascii_val(substring(l from 4067 for 1)) from q;
|
||||
"""
|
||||
|
||||
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
|
||||
act = isql_act('db', test_script)
|
||||
|
||||
expected_stdout_1 = """
|
||||
expected_stdout = """
|
||||
CHAR_LENGTH 4001
|
||||
POSITION 1
|
||||
POSITION 4001
|
||||
@ -68,7 +61,7 @@ expected_stdout_1 = """
|
||||
CHAR_LENGTH 5001
|
||||
POSITION 1
|
||||
POSITION 5001
|
||||
|
||||
|
||||
CHAR_LENGTH 5001
|
||||
POSITION 5001
|
||||
POSITION 1
|
||||
@ -77,9 +70,9 @@ expected_stdout_1 = """
|
||||
ASCII_VAL 32
|
||||
"""
|
||||
|
||||
@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,33 +1,26 @@
|
||||
#coding:utf-8
|
||||
#
|
||||
# id: bugs.core_3277
|
||||
# title: Wrong result for RIGHT(UTF8 varchar)
|
||||
# decription: Text was taken from Gutenberg project, several European languages are used
|
||||
# tracker_id: CORE-3277
|
||||
# min_versions: ['2.5.1']
|
||||
# versions: 2.5.1
|
||||
# qmid: None
|
||||
|
||||
"""
|
||||
ID: issue-3645
|
||||
ISSUE: 3645
|
||||
TITLE: Wrong result for RIGHT(UTF8 varchar)
|
||||
DESCRIPTION: Text was taken from Gutenberg project, several European languages are used
|
||||
JIRA: CORE-3277
|
||||
"""
|
||||
|
||||
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='core3277.fbk')
|
||||
|
||||
substitutions_1 = []
|
||||
|
||||
init_script_1 = """"""
|
||||
|
||||
db_1 = db_factory(from_backup='core3277.fbk', init=init_script_1)
|
||||
|
||||
test_script_1 = """
|
||||
test_script = """
|
||||
set list on;
|
||||
select s,left(s,10) ls10, right(s,10) rs10 from t;
|
||||
"""
|
||||
|
||||
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
|
||||
act = isql_act('db', test_script)
|
||||
|
||||
expected_stdout_1 = """
|
||||
expected_stdout = """
|
||||
S moří; že zplodí bezpočtu hrdin, kteří ponesou svou hořící duši
|
||||
LS10 moří; že z
|
||||
RS10 ořící duši
|
||||
@ -77,9 +70,9 @@ LS10 Men danske
|
||||
RS10 sa han, ä
|
||||
"""
|
||||
|
||||
@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(charset='utf8')
|
||||
assert act.clean_stdout == act.clean_expected_stdout
|
||||
|
||||
|
@ -1,33 +1,27 @@
|
||||
#coding:utf-8
|
||||
#
|
||||
# id: bugs.core_3282
|
||||
# title: EXECUTE STATEMENT parses the SQL text using wrong charset
|
||||
# decription:
|
||||
# tracker_id: CORE-3282
|
||||
# min_versions: ['2.5.1']
|
||||
# versions: 2.5.1
|
||||
# qmid: None
|
||||
|
||||
"""
|
||||
ID: issue-3650
|
||||
ISSUE: 3650
|
||||
TITLE: EXECUTE STATEMENT parses the SQL text using wrong charset
|
||||
DESCRIPTION:
|
||||
JIRA: CORE-3282
|
||||
"""
|
||||
|
||||
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='core3282.fbk')
|
||||
|
||||
substitutions_1 = []
|
||||
|
||||
init_script_1 = """"""
|
||||
|
||||
db_1 = db_factory(from_backup='core3282.fbk', init=init_script_1)
|
||||
|
||||
test_script_1 = """
|
||||
test_script = """
|
||||
execute procedure TESTSP; -- 2.5.0 only: get "Malformed string" when connect with cset=utf8, confirmed 26.02.2015
|
||||
"""
|
||||
|
||||
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
|
||||
|
||||
|
||||
@pytest.mark.version('>=2.5.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,31 +1,24 @@
|
||||
#coding:utf-8
|
||||
#
|
||||
# id: bugs.core_3283
|
||||
# title: BAD PLAN with using LEFT OUTER JOIN in SUBSELECT
|
||||
# decription:
|
||||
# tracker_id: CORE-3283
|
||||
# min_versions: ['2.5.1']
|
||||
# versions: 2.5.1
|
||||
# qmid: None
|
||||
|
||||
"""
|
||||
ID: issue-3651
|
||||
ISSUE: 3651
|
||||
TITLE: BAD PLAN with using LEFT OUTER JOIN in SUBSELECT
|
||||
DESCRIPTION:
|
||||
JIRA: CORE-3283
|
||||
"""
|
||||
|
||||
import pytest
|
||||
from firebird.qa import db_factory, isql_act, Action
|
||||
from firebird.qa import *
|
||||
|
||||
# version: 2.5.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 = """
|
||||
recreate table ttt (
|
||||
id int
|
||||
,constraint ttt_pk primary key (id) using index ttt_id
|
||||
);
|
||||
|
||||
|
||||
insert into ttt (id) values (0);
|
||||
insert into ttt (id) values (1);
|
||||
insert into ttt (id) values (2);
|
||||
@ -33,30 +26,30 @@ test_script_1 = """
|
||||
insert into ttt (id) values (4);
|
||||
insert into ttt (id) values (5);
|
||||
commit;
|
||||
|
||||
|
||||
set planonly;
|
||||
select t1.id from ttt t1
|
||||
where t1.id =
|
||||
(select t3.id
|
||||
(select t3.id
|
||||
from ttt t2
|
||||
left join ttt t3 on t3.id > t2.id
|
||||
where t2.id = 3
|
||||
where t2.id = 3
|
||||
order by t3.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 = """
|
||||
PLAN SORT (JOIN (T2 INDEX (TTT_ID), T3 INDEX (TTT_ID)))
|
||||
PLAN (T1 INDEX (TTT_ID))
|
||||
"""
|
||||
|
||||
@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,26 +1,19 @@
|
||||
#coding:utf-8
|
||||
#
|
||||
# id: bugs.core_3291
|
||||
# title: New pseudocolumn (RDB$RECORD_VERSION) to get number of the transaction that created a record version
|
||||
# decription:
|
||||
# tracker_id: CORE-3291
|
||||
# min_versions: ['3.0']
|
||||
# versions: 3.0
|
||||
# qmid: None
|
||||
|
||||
"""
|
||||
ID: issue-3659
|
||||
ISSUE: 3659
|
||||
TITLE: New pseudocolumn (RDB$RECORD_VERSION) to get number of the transaction that created a record version
|
||||
DESCRIPTION:
|
||||
JIRA: CORE-3291
|
||||
"""
|
||||
|
||||
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 = """
|
||||
set list on;
|
||||
recreate table test(id int);
|
||||
insert into test values(1) returning current_transaction - rdb$record_version as diff_ins;
|
||||
@ -30,17 +23,17 @@ test_script_1 = """
|
||||
delete from test returning sign(current_transaction - rdb$record_version) as diff_del;
|
||||
"""
|
||||
|
||||
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
|
||||
act = isql_act('db', test_script)
|
||||
|
||||
expected_stdout_1 = """
|
||||
expected_stdout = """
|
||||
DIFF_INS 0
|
||||
DIFF_UPD 0
|
||||
DIFF_DEL 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
|
||||
|
||||
|
@ -2,21 +2,24 @@
|
||||
#
|
||||
# id: bugs.core_3296
|
||||
# title: Error "context already in use" for the simple case function with a sub-select operand
|
||||
# decription:
|
||||
# decription:
|
||||
# tracker_id: CORE-3296
|
||||
# min_versions: ['2.1.5']
|
||||
# versions: 2.1.5
|
||||
# qmid: None
|
||||
|
||||
"""
|
||||
ID: issue-1298
|
||||
ISSUE: 1298
|
||||
TITLE: Error "context already in use" for the simple case function with a sub-select operand
|
||||
DESCRIPTION:
|
||||
JIRA: CORE-3296
|
||||
"""
|
||||
|
||||
import pytest
|
||||
from firebird.qa import db_factory, isql_act, Action
|
||||
from firebird.qa import *
|
||||
|
||||
# version: 2.1.5
|
||||
# resources: None
|
||||
|
||||
substitutions_1 = []
|
||||
|
||||
init_script_1 = """CREATE TABLE VAT_ZAK
|
||||
init_script = """CREATE TABLE VAT_ZAK
|
||||
(
|
||||
ID Integer NOT NULL,
|
||||
SYS_NR Integer,
|
||||
@ -31,9 +34,9 @@ CONSTRAINT PK_ELEMENTY__ID PRIMARY KEY (ID)
|
||||
);
|
||||
COMMIT;"""
|
||||
|
||||
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 = """UPDATE
|
||||
test_script = """UPDATE
|
||||
ELEMENTY E
|
||||
SET
|
||||
E.ID_VAT_SPRZ=
|
||||
@ -56,10 +59,11 @@ ELSE E.ID_VAT_SPRZ END;
|
||||
COMMIT;
|
||||
"""
|
||||
|
||||
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
|
||||
|
||||
|
||||
@pytest.mark.version('>=2.1.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,27 +1,24 @@
|
||||
#coding:utf-8
|
||||
#
|
||||
# id: bugs.core_3302
|
||||
# title: Distinct aggregates return wrong (duplicated) data
|
||||
# decription: Note: LIST() does not guarantee that returned values will be sorted so we can only count words in the resulting string and compare it with checked count
|
||||
# tracker_id: CORE-3302
|
||||
# min_versions: ['2.5.1']
|
||||
# versions: 2.5.1
|
||||
# qmid: None
|
||||
|
||||
"""
|
||||
ID: issue-3669
|
||||
ISSUE: 3669
|
||||
TITLE: Distinct aggregates return wrong (duplicated) data
|
||||
DESCRIPTION:
|
||||
LIST() does not guarantee that returned values will be sorted so we can only count words
|
||||
in the resulting string and compare it with checked count.
|
||||
JIRA: CORE-3302
|
||||
"""
|
||||
|
||||
import pytest
|
||||
from firebird.qa import db_factory, isql_act, Action
|
||||
from firebird.qa import *
|
||||
|
||||
# version: 2.5.1
|
||||
# resources: None
|
||||
|
||||
substitutions_1 = []
|
||||
|
||||
init_script_1 = """
|
||||
init_script = """
|
||||
recreate table t( dt date);
|
||||
commit;
|
||||
insert into t values( '2011-01-07' );
|
||||
insert into t values( '2011-01-07' );
|
||||
insert into t values( '2011-01-07' );
|
||||
insert into t values( '2011-01-07' );
|
||||
insert into t values( '2011-01-07' );
|
||||
insert into t values( '2011-01-06' );
|
||||
insert into t values( '2011-01-06' );
|
||||
insert into t values( '2011-01-06' );
|
||||
@ -31,17 +28,17 @@ 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;
|
||||
select char_length(s)-char_length(replace(s,',',''))+1 words_cnt, check_cnt
|
||||
from (
|
||||
select
|
||||
list(distinct
|
||||
case extract(weekday from dt)
|
||||
when 0 then 'Sun' when 1 then 'Mon' when 2 then 'Tue'
|
||||
when 3 then 'Wed' when 4 then 'Thu' when 5 then 'Fri'
|
||||
list(distinct
|
||||
case extract(weekday from dt)
|
||||
when 0 then 'Sun' when 1 then 'Mon' when 2 then 'Tue'
|
||||
when 3 then 'Wed' when 4 then 'Thu' when 5 then 'Fri'
|
||||
when 6 then 'Sat' end
|
||||
) s
|
||||
,count(distinct dt) check_cnt
|
||||
@ -50,16 +47,16 @@ 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 = """
|
||||
WORDS_CNT 3
|
||||
CHECK_CNT 3
|
||||
CHECK_CNT 3
|
||||
"""
|
||||
|
||||
@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,24 +1,19 @@
|
||||
#coding:utf-8
|
||||
#
|
||||
# id: bugs.core_3305
|
||||
# title: "BLOB not found" error after creation/altering of the invalid trigger
|
||||
# decription:
|
||||
# tracker_id: CORE-3305
|
||||
# min_versions: ['2.5.3']
|
||||
# versions: 2.5.3, 4.0
|
||||
# qmid: None
|
||||
|
||||
"""
|
||||
ID: issue-3672
|
||||
ISSUE: 3672
|
||||
TITLE: "BLOB not found" error after creation/altering of the invalid trigger
|
||||
DESCRIPTION:
|
||||
JIRA: CORE-3305
|
||||
"""
|
||||
|
||||
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)
|
||||
# version: 3.0
|
||||
|
||||
test_script_1 = """
|
||||
recreate table t(v int);
|
||||
@ -35,7 +30,7 @@ test_script_1 = """
|
||||
rollback;
|
||||
"""
|
||||
|
||||
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
|
||||
@ -44,20 +39,13 @@ expected_stderr_1 = """
|
||||
attempted update of read-only column
|
||||
"""
|
||||
|
||||
@pytest.mark.version('>=2.5.3,<4.0')
|
||||
@pytest.mark.version('>=3,<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 t(v int);
|
||||
@ -74,7 +62,7 @@ test_script_2 = """
|
||||
rollback;
|
||||
"""
|
||||
|
||||
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 = 42000
|
||||
|
@ -1,22 +1,17 @@
|
||||
#coding:utf-8
|
||||
#
|
||||
# id: bugs.core_3306
|
||||
# title: Invariant sub-query is treated as variant thus causing multiple invokations of a nested stored procedure
|
||||
# decription:
|
||||
# tracker_id: CORE-3306
|
||||
# min_versions: ['2.5.1']
|
||||
# versions: 3.0
|
||||
# qmid: None
|
||||
|
||||
"""
|
||||
ID: issue-3673
|
||||
ISSUE: 3673
|
||||
TITLE: Invariant sub-query is treated as variant thus causing multiple invokations of a nested stored procedure
|
||||
DESCRIPTION:
|
||||
JIRA: CORE-3306
|
||||
"""
|
||||
|
||||
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 Table tt_table(Field1 varchar(100))!!
|
||||
Create Or Alter PROCEDURE SPR_TEST (pName Varchar(2000)) RETURNS (sValue Varchar(255)) AS
|
||||
BEGIN
|
||||
@ -31,14 +26,11 @@ from rdb$types
|
||||
where rdb$field_name like (select sValue From spr_test('SIMSIM'));
|
||||
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 count(*) From tt_table;
|
||||
"""
|
||||
act = isql_act('db', "select count(*) from tt_table;")
|
||||
|
||||
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
|
||||
|
||||
expected_stdout_1 = """
|
||||
expected_stdout = """
|
||||
COUNT
|
||||
=====================
|
||||
1
|
||||
@ -46,8 +38,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,41 @@
|
||||
#coding:utf-8
|
||||
#
|
||||
# id: bugs.core_3310
|
||||
# title: RDB$GET_CONTEXT and between in view
|
||||
# decription:
|
||||
# tracker_id: CORE-3310
|
||||
# min_versions: ['3.0']
|
||||
# versions: 3.0
|
||||
# qmid: None
|
||||
|
||||
"""
|
||||
ID: issue-3677
|
||||
ISSUE: 3677
|
||||
TITLE: RDB$GET_CONTEXT and between in view
|
||||
DESCRIPTION:
|
||||
JIRA: CORE-3310
|
||||
"""
|
||||
|
||||
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='employee-ods12.fbk')
|
||||
|
||||
substitutions_1 = []
|
||||
|
||||
init_script_1 = """"""
|
||||
|
||||
db_1 = db_factory(from_backup='employee-ods12.fbk', init=init_script_1)
|
||||
|
||||
test_script_1 = """
|
||||
test_script = """
|
||||
create or alter view v_test
|
||||
as
|
||||
select s.po_number
|
||||
from sales s
|
||||
where
|
||||
cast(coalesce(rdb$get_context('USER_SESSION', 'SELECTED_DATE'), '12.12.1993') as timestamp)
|
||||
between
|
||||
where
|
||||
cast(coalesce(rdb$get_context('USER_SESSION', 'SELECTED_DATE'), '12.12.1993') as timestamp)
|
||||
between
|
||||
s.order_date and s.date_needed
|
||||
;
|
||||
set list on;
|
||||
select * from v_test v order by v.po_number 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 = """
|
||||
PO_NUMBER V9320630
|
||||
"""
|
||||
|
||||
@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_3311
|
||||
# title: Error "data type unknown" while preparing UPDATE/DELETE statements with the parameterized ROWS clause
|
||||
# decription:
|
||||
# tracker_id: CORE-3311
|
||||
# min_versions: ['2.5.1']
|
||||
# versions: 3.0
|
||||
# qmid: None
|
||||
|
||||
"""
|
||||
ID: issue-3678
|
||||
ISSUE: 3678
|
||||
TITLE: Error "data type unknown" while preparing UPDATE/DELETE statements with the parameterized ROWS clause
|
||||
DESCRIPTION:
|
||||
JIRA: CORE-3311
|
||||
"""
|
||||
|
||||
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 = """
|
||||
recreate table test(id int);
|
||||
commit;
|
||||
insert into test select rand()*1000 from rdb$types,(select 1 i from rdb$types rows 10);
|
||||
@ -25,9 +20,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 = """
|
||||
set planonly;
|
||||
select * from test rows ?;
|
||||
select * from test where id between ? and ? order by id rows ? to ?;
|
||||
@ -35,24 +30,24 @@ test_script_1 = """
|
||||
update test set id=id where id between ? and ? order by id rows ? to ?;
|
||||
delete from test rows ? to ?;
|
||||
delete from test where id between ? and ? order by id rows ? to ?;
|
||||
merge into test t
|
||||
using(
|
||||
merge into test t
|
||||
using(
|
||||
select id from test where id between ? and ? rows ?
|
||||
) s
|
||||
on t.id=s.id
|
||||
) s
|
||||
on t.id=s.id
|
||||
when matched then update set t.id=s.id;
|
||||
merge into test t
|
||||
using(
|
||||
select id from test where id between ? and ? order by id rows ?
|
||||
) s
|
||||
on t.id=s.id
|
||||
merge into test t
|
||||
using(
|
||||
select id from test where id between ? and ? order by id rows ?
|
||||
) s
|
||||
on t.id=s.id
|
||||
when matched then update set t.id=s.id;
|
||||
set planonly;
|
||||
"""
|
||||
|
||||
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 NATURAL)
|
||||
PLAN (TEST ORDER TEST_ID)
|
||||
PLAN (TEST NATURAL)
|
||||
@ -64,8 +59,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_3312
|
||||
# title: Sub-optimal join plan when the slave table depends on the master one via the OR predicate
|
||||
# decription:
|
||||
# tracker_id: CORE-3312
|
||||
# min_versions: ['2.5.1']
|
||||
# versions: 2.5.1
|
||||
# qmid: None
|
||||
|
||||
"""
|
||||
ID: issue-3679
|
||||
ISSUE: 3679
|
||||
TITLE: Sub-optimal join plan when the slave table depends on the master one via the OR predicate
|
||||
DESCRIPTION:
|
||||
JIRA: CORE-3312
|
||||
"""
|
||||
|
||||
import pytest
|
||||
from firebird.qa import db_factory, isql_act, Action
|
||||
from firebird.qa import *
|
||||
|
||||
# version: 2.5.1
|
||||
# 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 *
|
||||
from rdb$relations r
|
||||
join rdb$security_classes sc
|
||||
@ -33,18 +26,16 @@ from rdb$relations r
|
||||
or (r.rdb$default_class = sc.rdb$security_class and r.rdb$relation_id = 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_3312.fdb, User: SYSDBA
|
||||
SQL> SQL> CON> CON> CON> CON>
|
||||
expected_stdout = """
|
||||
PLAN JOIN (R NATURAL, SC INDEX (RDB$INDEX_7, RDB$INDEX_7))
|
||||
SQL> CON> CON> CON> CON>
|
||||
PLAN JOIN (R INDEX (RDB$INDEX_1, RDB$INDEX_1), SC INDEX (RDB$INDEX_7, RDB$INDEX_7))
|
||||
SQL>"""
|
||||
"""
|
||||
|
||||
@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,50 +1,43 @@
|
||||
#coding:utf-8
|
||||
#
|
||||
# id: bugs.core_3314
|
||||
# title: Dependencies are not removed after dropping the procedure and the table it depends on in the same transaction
|
||||
# decription:
|
||||
# tracker_id: CORE-3314
|
||||
# min_versions: ['2.5.1']
|
||||
# versions: 2.5.1
|
||||
# qmid: None
|
||||
|
||||
"""
|
||||
ID: issue-3681
|
||||
ISSUE: 3681
|
||||
TITLE: Dependencies are not removed after dropping the procedure and the table it depends on in the same transaction
|
||||
DESCRIPTION:
|
||||
JIRA: CORE-3314
|
||||
"""
|
||||
|
||||
import pytest
|
||||
from firebird.qa import db_factory, isql_act, Action
|
||||
from firebird.qa import *
|
||||
|
||||
# version: 2.5.1
|
||||
# resources: None
|
||||
|
||||
substitutions_1 = []
|
||||
|
||||
init_script_1 = """create table t (a int);
|
||||
init_script = """create table t (a int);
|
||||
SET TERM !!;
|
||||
create procedure p as begin delete from t; end!!
|
||||
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 1 FROM RDB$DEPENDENCIES WHERE RDB$DEPENDED_ON_NAME='T';
|
||||
test_script = """SELECT 1 FROM RDB$DEPENDENCIES WHERE RDB$DEPENDED_ON_NAME='T';
|
||||
drop procedure p;
|
||||
drop table t;
|
||||
commit;
|
||||
SELECT 1 FROM RDB$DEPENDENCIES WHERE RDB$DEPENDED_ON_NAME='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_3314.fdb, User: SYSDBA
|
||||
SQL>
|
||||
expected_stdout = """
|
||||
CONSTANT
|
||||
============
|
||||
1
|
||||
"""
|
||||
|
||||
SQL> SQL> SQL> SQL> SQL>"""
|
||||
|
||||
@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,64 +1,85 @@
|
||||
#coding:utf-8
|
||||
#
|
||||
# id: bugs.core_3323
|
||||
# title: Ability to cancel waiting in lock manager
|
||||
# decription:
|
||||
# Fully reimplemented 10.01.2020. Reason: ISQL-"killer" could not find record in mon$attachments that should be deleted.
|
||||
#
|
||||
# Test asynchronously launches ISQL with script that will hang because of two concurrent attachments trying to update
|
||||
# the same record (second attachment is created using ES/EDS).
|
||||
# After this we have to launch second instance of ISQL which will attempt to kill both connections created in the 1st ISQL.
|
||||
#
|
||||
# The *most* problem here is properly determine time that we have to wait until 1st ISQL will really establish its connect!
|
||||
# If this time is too short then second ISQL ("killer") will NOT able to see 1st ISQL in mon$attachments and will not be able
|
||||
# to delete (because there will be NOT YET attachment to delete!). This mean that 2nd ISQL will finish without really check
|
||||
# that it could kill hanged attachments. Test in this case will not finish if 1st ISQL uses tx with infinite WAIT!
|
||||
#
|
||||
# To be sure that 2nd ISQL ("killer") will be able to see 1st one ("hanged") we have to make pretty long PSQL-loop which tries
|
||||
# to find any record in mon$attachment that is from concurrent connection (which user name we know for advance: 'tmp$c3323').
|
||||
# This PSQL loop must finish as fast as we find record that will be then deleted.
|
||||
#
|
||||
# Lot of runs show that there is a problem in 4.0.0 Classic: it requires too long time in PSQL loop to find such attachment.
|
||||
# Time in 4.0 CS can be about 1-2 seconds and number of iterations will be greater than 100.
|
||||
# No such problem in all 3.0 and in 4.0 for other modes.
|
||||
#
|
||||
# 24.12.2020
|
||||
# Waiting for completion of child ISQL async process is done by call <isql_PID>.wait() instead of old (and "fragile")
|
||||
# assumption about maximal time that it could last before forcedly terminate it.
|
||||
# Checked on:
|
||||
# 4.0.0.2307 SS: 4.348s.
|
||||
# 4.0.0.2324 SS: 4.301s.
|
||||
# 4.0.0.2324 CS: 4.959s.
|
||||
# 3.0.8.33401 SS: 3.225s.
|
||||
# 3.0.8.33401 SC: 2.236s.
|
||||
# 3.0.8.33401 CS: 4.543s.
|
||||
# 2.5.9.27152 SC: 1.006s.
|
||||
# 2.5.9.27152 CS: 1.333s.
|
||||
#
|
||||
#
|
||||
# [pcisar] 17.11.2021
|
||||
# This test is too complicated and fragile (can screw the test environment)
|
||||
# It should be reimplemnted in more robust way, or removed from suite
|
||||
#
|
||||
# tracker_id: CORE-3323
|
||||
# min_versions: ['2.5.1']
|
||||
# versions: 2.5.1
|
||||
# qmid: None
|
||||
|
||||
"""
|
||||
ID: issue-3690
|
||||
ISSUE: 3690
|
||||
TITLE: Ability to cancel waiting in lock manager
|
||||
DESCRIPTION:
|
||||
Fully reimplemented 10.01.2020. Reason: ISQL-"killer" could not find record in
|
||||
mon$attachments that should be deleted.
|
||||
|
||||
Test asynchronously launches ISQL with script that will hang because of two concurrent
|
||||
attachments trying to update the same record (second attachment is created using ES/EDS).
|
||||
After this we have to launch second instance of ISQL which will attempt to kill both
|
||||
connections created in the 1st ISQL.
|
||||
|
||||
The *most* problem here is properly determine time that we have to wait until 1st ISQL
|
||||
will really establish its connect! If this time is too short then second ISQL ("killer")
|
||||
will NOT able to see 1st ISQL in mon$attachments and will not be able to delete (because
|
||||
there will be NOT YET attachment to delete!). This mean that 2nd ISQL will finish without
|
||||
really check that it could kill hanged attachments. Test in this case will not finish if
|
||||
1st ISQL uses tx with infinite WAIT!
|
||||
|
||||
To be sure that 2nd ISQL ("killer") will be able to see 1st one ("hanged") we have to
|
||||
make pretty long PSQL-loop which tries to find any record in mon$attachment that is from
|
||||
concurrent connection (which user name we know for advance: 'tmp$c3323').
|
||||
This PSQL loop must finish as fast as we find record that will be then deleted.
|
||||
|
||||
Lot of runs show that there is a problem in 4.0.0 Classic: it requires too long time in
|
||||
PSQL loop to find such attachment. Time in 4.0 CS can be about 1-2 seconds and number of
|
||||
iterations will be greater than 100. No such problem in all 3.0 and in 4.0 for other modes.
|
||||
notes:
|
||||
[24.12.2020]
|
||||
Waiting for completion of child ISQL async process is done by call <isql_PID>.wait()
|
||||
instead of old (and "fragile") assumption about maximal time that it could last before
|
||||
forcedly terminate it.
|
||||
[17.11.2021]
|
||||
This test is too complicated and fragile (can screw the test environment)
|
||||
It should be reimplemnted in more robust way, or removed from suite
|
||||
JIRA: CORE-3323
|
||||
"""
|
||||
|
||||
import pytest
|
||||
from firebird.qa import db_factory, python_act, Action
|
||||
from firebird.qa import *
|
||||
|
||||
# version: 2.5.1
|
||||
# resources: None
|
||||
|
||||
substitutions_1 = [('Data source : Firebird::localhost:.*', 'Data source : Firebird::localhost'),
|
||||
substitutions = [('Data source : Firebird::localhost:.*', 'Data source : Firebird::localhost'),
|
||||
('After line.*', ''), ('.*Killed by database administrator.*', ''),
|
||||
('-At block line:.*', '-At block line'),
|
||||
('Execute statement error at isc_dsql_(execute2|prepare)', 'Execute statement error at isc_dsql')]
|
||||
|
||||
init_script_1 = """"""
|
||||
db = db_factory()
|
||||
|
||||
|
||||
act = python_act('db', substitutions=substitutions)
|
||||
|
||||
expected_stdout = """
|
||||
Point_A: starting EB with lock-conflict
|
||||
id_at_point_A: -1
|
||||
Statement failed, SQLSTATE = 42000
|
||||
Execute statement error at isc_dsql_execute2 :
|
||||
335544856 : connection shutdown
|
||||
Statement : update test set id = - (1000 + id)
|
||||
Data source : Firebird::localhost
|
||||
-At block line
|
||||
Point_B finished EB with lock-conflict
|
||||
id_at_point_B: -1
|
||||
point_C: Intro script that must kill other attachment
|
||||
point_D: starting kill hanged connection
|
||||
id_at_point_D: 1
|
||||
ATTACHMENT_TO_BE_KILLED <EXPECTED: NOT NULL>
|
||||
point_E: Running delete from mon$attachments statement
|
||||
Records affected: 1
|
||||
point_F: Reconnect and look for attachment of other user
|
||||
id_at_point_F: 1
|
||||
STILL_ALIVE_ATTACHMENT_ID <EXPECTED: NULL>
|
||||
pointG: finished kill hanged connection
|
||||
"""
|
||||
|
||||
@pytest.mark.skip("Test fate to be determined")
|
||||
@pytest.mark.version('>=3')
|
||||
def test_1(act: Action):
|
||||
pytest.skip("Test not IMPLEMENTED")
|
||||
|
||||
db_1 = db_factory(sql_dialect=3, init=init_script_1)
|
||||
|
||||
# test_script_1
|
||||
#---
|
||||
@ -328,34 +349,3 @@ db_1 = db_factory(sql_dialect=3, init=init_script_1)
|
||||
#
|
||||
#
|
||||
#---
|
||||
|
||||
act_1 = python_act('db_1', substitutions=substitutions_1)
|
||||
|
||||
expected_stdout_1 = """
|
||||
Point_A: starting EB with lock-conflict
|
||||
id_at_point_A: -1
|
||||
Statement failed, SQLSTATE = 42000
|
||||
Execute statement error at isc_dsql_execute2 :
|
||||
335544856 : connection shutdown
|
||||
Statement : update test set id = - (1000 + id)
|
||||
Data source : Firebird::localhost
|
||||
-At block line
|
||||
Point_B finished EB with lock-conflict
|
||||
id_at_point_B: -1
|
||||
point_C: Intro script that must kill other attachment
|
||||
point_D: starting kill hanged connection
|
||||
id_at_point_D: 1
|
||||
ATTACHMENT_TO_BE_KILLED <EXPECTED: NOT NULL>
|
||||
point_E: Running delete from mon$attachments statement
|
||||
Records affected: 1
|
||||
point_F: Reconnect and look for attachment of other user
|
||||
id_at_point_F: 1
|
||||
STILL_ALIVE_ATTACHMENT_ID <EXPECTED: NULL>
|
||||
pointG: finished kill hanged connection
|
||||
"""
|
||||
|
||||
@pytest.mark.version('>=2.5.1')
|
||||
def test_1(act_1: Action):
|
||||
pytest.skip("New implementation postponed")
|
||||
|
||||
|
||||
|
@ -1,279 +1,32 @@
|
||||
#coding:utf-8
|
||||
#
|
||||
# id: bugs.core_3328
|
||||
# title: Client writes error messages into firebird.log when database is shutted down
|
||||
# decription:
|
||||
# Test retrieves FB engine version in order to issue proper command option for getting firebird.log content
|
||||
# (in 2.5 this is 'action_get_ib_log' rather then expected 'action_get_fb_log' - note on letter 'i' instead 'f').
|
||||
# Initial content of firebird.log is saved into file, see var. 'f_fblog_before'.
|
||||
# Then it starts child process (ISQL) which does some "heavy DML" activity and allows this ISQL to do it several seconds.
|
||||
# After this, main thread calls FBSVCMGR with commands to move database to SHUTDOWN state and back to online.
|
||||
# This should terminate child ISQL and after small delay one may to query new content of firebird.log.
|
||||
# New firebird.log is saved into file, see var. 'f_fblog_after', so further its two versions can be compared.
|
||||
# Comparison is done by using standard Python package 'difflib'.
|
||||
# Difference between old and new firebird.log should _NOT_ contain lines with words 'gds__detach' or 'lost'.
|
||||
# If these words absent - all fine, actual and expected output both have to be empty.
|
||||
#
|
||||
# 04-dec-2016.
|
||||
# Checked on: WI-V2.5.7.27028, WI-V3.0.2.32642, WI-T4.0.0.460 (all on SS/SC/CS).
|
||||
# Reduced time of ISQL working from 5 to 2 seconds.
|
||||
#
|
||||
# Samples of call with '-c <path_to_fbclient_dll>':
|
||||
#
|
||||
# fbt_run -b C:\\MIX\\firebird\\fb25\\bin bugs.core_3328 -o localhost/3255 -c C:\\MIX\\firebird\\fb25\\fbinbclient.dll
|
||||
# fbt_run -b C:\\MIX\\firebird\\fb25Cs\\bin bugs.core_3328 -o localhost/3249 -c C:\\MIX\\firebird\\fb25cs\\bin\\fbclient.dll
|
||||
# fbt_run -b C:\\MIX\\firebird\\fb40Cs bugs.core_3328 -o localhost/3439 -c C:\\MIX\\firebird\\fb40cs\\fbclient.dll
|
||||
# fbt_run -b C:\\MIX\\firebird\\fb40sc bugs.core_3328 -o localhost/3430 -c C:\\MIX\\firebird\\fb40sc\\fbclient.dll & fbt_view -d results.trf
|
||||
#
|
||||
# tracker_id: CORE-3328
|
||||
# min_versions: ['2.5.1']
|
||||
# versions: 2.5.1
|
||||
# qmid: None
|
||||
|
||||
"""
|
||||
ID: issue-3694
|
||||
ISSUE: 3694
|
||||
TITLE: Client writes error messages into firebird.log when database is shutted down
|
||||
DESCRIPTION:
|
||||
Difference between old and new firebird.log should _NOT_ contain lines with words 'gds__detach' or 'lost'.
|
||||
If these words absent - all fine, actual and expected output both have to be empty.
|
||||
JIRA: CORE-3328
|
||||
"""
|
||||
|
||||
import pytest
|
||||
import time
|
||||
from difflib import unified_diff
|
||||
from threading import Thread
|
||||
from firebird.qa import db_factory, python_act, Action
|
||||
from firebird.qa import *
|
||||
from firebird.driver import ShutdownMethod, ShutdownMode
|
||||
|
||||
# version: 2.5.1
|
||||
# resources: None
|
||||
|
||||
# substitutions_1 = [('attachments: [1-9]+', 'attachments: 1'), ('[\\s]+', ' ')]
|
||||
substitutions_1 = [('database.*shutdown', 'database shutdown')]
|
||||
|
||||
init_script_1 = """
|
||||
init_script = """
|
||||
create table test(s varchar(36) unique);
|
||||
commit;
|
||||
"""
|
||||
|
||||
db_1 = db_factory(sql_dialect=3, init=init_script_1)
|
||||
db = db_factory(init=init_script)
|
||||
|
||||
# test_script_1
|
||||
#---
|
||||
# import os
|
||||
# import subprocess
|
||||
# from subprocess import Popen
|
||||
# import time
|
||||
# import difflib
|
||||
# from fdb import services
|
||||
#
|
||||
# os.environ["ISC_USER"] = user_name
|
||||
# os.environ["ISC_PASSWORD"] = user_password
|
||||
#
|
||||
# db_file=db_conn.database_name
|
||||
# engine = str(db_conn.engine_version) # convert to text because 'float' object has no attribute 'startswith'
|
||||
# db_conn.close()
|
||||
#
|
||||
# #---------------------------------------------------
|
||||
# def svc_get_fb_log( engine, f_fb_log ):
|
||||
#
|
||||
# import subprocess
|
||||
#
|
||||
# if engine.startswith('2.5'):
|
||||
# get_firebird_log_key='action_get_ib_log'
|
||||
# else:
|
||||
# get_firebird_log_key='action_get_fb_log'
|
||||
#
|
||||
# subprocess.call( [ context['fbsvcmgr_path'],
|
||||
# "localhost:service_mgr",
|
||||
# get_firebird_log_key
|
||||
# ],
|
||||
# stdout=f_fb_log,
|
||||
# stderr=subprocess.STDOUT
|
||||
# )
|
||||
# return
|
||||
#
|
||||
#
|
||||
# #---------------------------------------------
|
||||
#
|
||||
# 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] )
|
||||
# if os.path.isfile( f_names_list[i]):
|
||||
# print('ERROR: can not remove file ' + f_names_list[i])
|
||||
#
|
||||
# #--------------------------------------------
|
||||
#
|
||||
#
|
||||
# # Get HOME dir of FB instance that is now checked.
|
||||
# # We will concatenate this string with 'fbsvcmgr' command in order to choose
|
||||
# # PROPER binary file when querying services API to shutdown/online DB
|
||||
# # NOTE: this is NECESSARY if several instances are in work and we did not change
|
||||
# # PATH variable before call this test!
|
||||
#
|
||||
# # NB, 06.12.2016: as of fdb 1.6.1 one need to EXPLICITLY specify user+password pair when doing connect
|
||||
# # via to FB services API by services.connect() - see FB tracker, PYFB-69
|
||||
# # ("Can not connect to FB services if set ISC_USER & ISC_PASSWORD by os.environ[ ... ]")
|
||||
#
|
||||
# f_fblog_before=open( os.path.join(context['temp_directory'],'tmp_3328_fblog_before.txt'), 'w')
|
||||
# svc_get_fb_log( engine, f_fblog_before )
|
||||
# flush_and_close( f_fblog_before )
|
||||
#
|
||||
# sql_dml='''
|
||||
# show version;
|
||||
# set term ^;
|
||||
# execute block as
|
||||
# declare v_role varchar(31);
|
||||
# begin
|
||||
# v_role = left(replace( uuid_to_char(gen_uuid()), '-', ''), 31);
|
||||
# while (1=1) do
|
||||
# begin
|
||||
# insert into test(s) values( uuid_to_char( gen_uuid() ) );
|
||||
# end
|
||||
# end
|
||||
# ^
|
||||
# set term ;^
|
||||
# '''
|
||||
#
|
||||
# f_client_sql = open( os.path.join(context['temp_directory'],'tmp_client_3328.sql'), 'w')
|
||||
# f_client_sql.write(sql_dml)
|
||||
# flush_and_close( f_client_sql )
|
||||
#
|
||||
# f_client_log = open( os.path.join(context['temp_directory'],'tmp_client_3328.log'), 'w')
|
||||
# p_client_dml=subprocess.Popen( [context['isql_path'], dsn, "-n", "-i", f_client_sql.name ],
|
||||
# stdout = f_client_log,
|
||||
# stderr = subprocess.STDOUT
|
||||
# )
|
||||
# time.sleep(2)
|
||||
#
|
||||
# f_shutdown_log = open( os.path.join(context['temp_directory'],'tmp_shutdown_and_online_3328.log'), 'w')
|
||||
#
|
||||
# # Databases:
|
||||
# # Number of attachments: 1
|
||||
# # Number of databases: 1
|
||||
# # Database in use: C:\\MIX\\FIREBIRD\\QA\\FBT-REPO\\TMP\\BUGS.CORE_3328.FDB
|
||||
# subprocess.call( [context['fbsvcmgr_path'],"localhost:service_mgr",
|
||||
# "info_svr_db_info",
|
||||
# ],
|
||||
# stdout = f_shutdown_log,
|
||||
# stderr=subprocess.STDOUT
|
||||
# )
|
||||
#
|
||||
# subprocess.call( [context['fbsvcmgr_path'], "localhost:service_mgr",
|
||||
# "action_properties", "prp_shutdown_mode", "prp_sm_full", "prp_shutdown_db", "0",
|
||||
# "dbname", db_file,
|
||||
# ],
|
||||
# stdout = f_shutdown_log,
|
||||
# stderr = subprocess.STDOUT
|
||||
# )
|
||||
#
|
||||
# # Databases:
|
||||
# # Number of attachments: 0
|
||||
# # Number of databases: 0
|
||||
# subprocess.call( [context['fbsvcmgr_path'],"localhost:service_mgr",
|
||||
# "info_svr_db_info",
|
||||
# ],
|
||||
# stdout = f_shutdown_log,
|
||||
# stderr=subprocess.STDOUT
|
||||
# )
|
||||
#
|
||||
# subprocess.call( [context['fbsvcmgr_path'],"localhost:service_mgr",
|
||||
# "action_db_stats",
|
||||
# "dbname", db_file, "sts_hdr_pages"
|
||||
# ],
|
||||
# stdout = f_shutdown_log,
|
||||
# stderr=subprocess.STDOUT
|
||||
# )
|
||||
#
|
||||
# subprocess.call( [context['fbsvcmgr_path'], "localhost:service_mgr",
|
||||
# "action_properties", "prp_db_online",
|
||||
# "dbname", db_file,
|
||||
# ],
|
||||
# stdout = f_shutdown_log,
|
||||
# stderr = subprocess.STDOUT
|
||||
# )
|
||||
#
|
||||
# subprocess.call( [context['fbsvcmgr_path'],"localhost:service_mgr",
|
||||
# "action_db_stats",
|
||||
# "dbname", db_file, "sts_hdr_pages"
|
||||
# ],
|
||||
# stdout = f_shutdown_log,
|
||||
# stderr=subprocess.STDOUT
|
||||
# )
|
||||
#
|
||||
# flush_and_close( f_shutdown_log )
|
||||
#
|
||||
#
|
||||
# f_fblog_after=open( os.path.join(context['temp_directory'],'tmp_3328_fblog_after.txt'), 'w')
|
||||
# svc_get_fb_log( engine, f_fblog_after )
|
||||
# flush_and_close( f_fblog_after )
|
||||
#
|
||||
# p_client_dml.terminate()
|
||||
# flush_and_close( f_client_log )
|
||||
#
|
||||
# # Now we can compare two versions of firebird.log and check their difference.
|
||||
#
|
||||
# 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_3328_diff.txt'), 'w')
|
||||
# f_diff_txt.write(difftext)
|
||||
# flush_and_close( f_diff_txt )
|
||||
#
|
||||
# # New lines in firebird.log must |NOT| contain these:
|
||||
# # ===
|
||||
# # REMOTE INTERFACE/gds__detach: Unsuccesful detach from database.
|
||||
# # Uncommitted work may have been lost
|
||||
# # ===
|
||||
# # If such lines present - this is regression and we output them.
|
||||
# # When all fine, final output is empty.
|
||||
# #
|
||||
# # BTW: for 3.0, firebird.log will contain such text:
|
||||
# # INET/INET_ERROR: READ ERRNO = 10054, SERVER HOST = LOCALHOST, ADDRESS = 127.0.0.1/3333
|
||||
# # -- but this is checked by another .fbt
|
||||
#
|
||||
# with open( f_shutdown_log.name,'r') as f:
|
||||
# for line in f:
|
||||
# if ( 'unknown' in line.lower() or 'attributes' in line.lower() ):
|
||||
# print(line)
|
||||
# #or 'attachments' in line.lower()
|
||||
#
|
||||
# with open( f_diff_txt.name,'r') as f:
|
||||
# for line in f:
|
||||
# if line.startswith('+') and ('gds__detach' in line or 'lost' in line):
|
||||
# print(line.upper())
|
||||
#
|
||||
# ###############################
|
||||
# # Cleanup.
|
||||
# cleanup( [i.name for i in (f_shutdown_log,f_client_sql,f_client_log,f_fblog_before,f_fblog_after,f_diff_txt) ] )
|
||||
#
|
||||
# # NB: temply removed following lines from expected_stdout,
|
||||
# # see core-5413, "fbsvcmgr info_svr_db_info does not see active attachments and databases in use (CLASSIC only)"
|
||||
# # Number of attachments: 1
|
||||
# # Number of attachments: 0
|
||||
#
|
||||
#
|
||||
#---
|
||||
act = python_act('db', substitutions=[('database.*shutdown', 'database shutdown')])
|
||||
|
||||
act_1 = python_act('db_1', substitutions=substitutions_1)
|
||||
|
||||
expected_stderr_1 = """
|
||||
expected_stderr = """
|
||||
Statement failed, SQLSTATE = HY000
|
||||
database /tmp/pytest-of-pcisar/pytest-528/test_10/test.fdb shutdown
|
||||
Statement failed, SQLSTATE = HY000
|
||||
@ -295,23 +48,23 @@ def run_work(act: Action):
|
||||
end
|
||||
^
|
||||
set term ;^
|
||||
"""
|
||||
act.expected_stderr = expected_stderr_1
|
||||
"""
|
||||
act.expected_stderr = expected_stderr
|
||||
act.isql(switches=['-n'], input=test_script)
|
||||
|
||||
@pytest.mark.version('>=3.0')
|
||||
def test_1(act_1: Action):
|
||||
with act_1.connect_server() as srv:
|
||||
def test_1(act: Action):
|
||||
with act.connect_server() as srv:
|
||||
srv.info.get_log()
|
||||
log_before = srv.readlines()
|
||||
#
|
||||
work_thread = Thread(target=run_work, args=[act_1])
|
||||
work_thread = Thread(target=run_work, args=[act])
|
||||
work_thread.start()
|
||||
time.sleep(2)
|
||||
#
|
||||
srv.database.shutdown(database=act_1.db.db_path, mode=ShutdownMode.FULL,
|
||||
srv.database.shutdown(database=act.db.db_path, mode=ShutdownMode.FULL,
|
||||
method=ShutdownMethod.FORCED, timeout=0)
|
||||
srv.database.bring_online(database=act_1.db.db_path)
|
||||
srv.database.bring_online(database=act.db.db_path)
|
||||
#
|
||||
srv.info.get_log()
|
||||
log_after = srv.readlines()
|
||||
@ -321,4 +74,4 @@ def test_1(act_1: Action):
|
||||
pytest.fail('Work thread is still alive')
|
||||
#
|
||||
assert list(unified_diff(log_before, log_after)) == []
|
||||
assert act_1.clean_stderr == act_1.clean_expected_stderr
|
||||
assert act.clean_stderr == act.clean_expected_stderr
|
||||
|
@ -1,38 +1,32 @@
|
||||
#coding:utf-8
|
||||
#
|
||||
# id: bugs.core_3330
|
||||
# title: Server crashes while recreating the table with a NULL -> NOT NULL change
|
||||
# decription:
|
||||
# tracker_id: CORE-3330
|
||||
# min_versions: ['3.0']
|
||||
# versions: 3.0
|
||||
# qmid: None
|
||||
|
||||
"""
|
||||
ID: issue-3696
|
||||
ISSUE: 3696
|
||||
TITLE: Server crashes while recreating the table with a NULL -> NOT NULL change
|
||||
DESCRIPTION:
|
||||
JIRA: CORE-1000
|
||||
"""
|
||||
|
||||
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 table test (a int);
|
||||
commit;
|
||||
insert into test (a) values (null);
|
||||
commit;
|
||||
recreate table test (b int not null);
|
||||
commit; -- crash here
|
||||
commit; -- crash here
|
||||
"""
|
||||
|
||||
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
|
||||
|
||||
act = isql_act('db', test_script)
|
||||
|
||||
@pytest.mark.version('>=3.0')
|
||||
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,26 +1,19 @@
|
||||
#coding:utf-8
|
||||
#
|
||||
# id: bugs.core_3335
|
||||
# title: Wrong results (internal wrapping occured) for the multi-byte blob SUBSTRING function and its boundary arguments
|
||||
# decription:
|
||||
# tracker_id: CORE-3335
|
||||
# min_versions: ['2.1.5']
|
||||
# versions: 2.1.5
|
||||
# qmid: None
|
||||
|
||||
"""
|
||||
ID: issue-3701
|
||||
ISSUE: 3701
|
||||
TITLE: Wrong results (internal wrapping occured) for the multi-byte blob SUBSTRING function and its boundary arguments
|
||||
DESCRIPTION:
|
||||
JIRA: CORE-3335
|
||||
"""
|
||||
|
||||
import pytest
|
||||
from firebird.qa import db_factory, isql_act, Action
|
||||
from firebird.qa import *
|
||||
|
||||
# version: 2.1.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 = """select substring(cast('abcdef' as blob sub_type text character set utf8)
|
||||
test_script = """select substring(cast('abcdef' as blob sub_type text character set utf8)
|
||||
from 1 for 2147483647) from rdb$database;
|
||||
select substring(cast('abcdef' as blob sub_type text character set utf8)
|
||||
from 2 for 2147483647) from rdb$database;
|
||||
@ -30,10 +23,9 @@ select substring(cast('abcdef' as blob sub_type text character set utf8)
|
||||
from 3 for 2147483646) 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:\\fbtestnew\\tmp\\bugs.core_3335.fdb, User: SYSDBA
|
||||
SQL> CON>
|
||||
expected_stdout = """
|
||||
SUBSTRING
|
||||
=================
|
||||
0:2
|
||||
@ -42,7 +34,6 @@ SUBSTRING:
|
||||
abcdef
|
||||
==============================================================================
|
||||
|
||||
SQL> CON>
|
||||
SUBSTRING
|
||||
=================
|
||||
0:6
|
||||
@ -51,7 +42,6 @@ SUBSTRING:
|
||||
bcdef
|
||||
==============================================================================
|
||||
|
||||
SQL> CON>
|
||||
SUBSTRING
|
||||
=================
|
||||
0:a
|
||||
@ -60,7 +50,6 @@ SUBSTRING:
|
||||
cdef
|
||||
==============================================================================
|
||||
|
||||
SQL> CON>
|
||||
SUBSTRING
|
||||
=================
|
||||
0:e
|
||||
@ -68,12 +57,11 @@ SQL> CON>
|
||||
SUBSTRING:
|
||||
cdef
|
||||
==============================================================================
|
||||
"""
|
||||
|
||||
SQL>"""
|
||||
|
||||
@pytest.mark.version('>=2.1.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,41 @@
|
||||
#coding:utf-8
|
||||
#
|
||||
# id: bugs.core_3338
|
||||
# title: Regression: Code changes disabled support for expression indexes with COALESCE, CASE and DECODE
|
||||
# decription:
|
||||
# tracker_id: CORE-3338
|
||||
# min_versions: ['3.0']
|
||||
# versions: 3.0
|
||||
# qmid: None
|
||||
|
||||
"""
|
||||
ID: issue-3704
|
||||
ISSUE: 3704
|
||||
TITLE: Regression: Code changes disabled support for expression indexes with COALESCE, CASE and DECODE
|
||||
DESCRIPTION:
|
||||
JIRA: CORE-3338
|
||||
"""
|
||||
|
||||
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 t(n int); commit;
|
||||
insert into t select rand()*100 from rdb$types; commit;
|
||||
|
||||
create index t_n2_coalesce on t computed by ( coalesce(n*2,0) ); commit;
|
||||
create index t_n2_decode on t computed by ( decode( mod(n, 3), 0, coalesce(n,0), 1, iif(mod(n,7)=0, 2, 3) ) ); commit;
|
||||
|
||||
-- 2.5 raises:
|
||||
-- Statement failed, SQLSTATE = HY000
|
||||
-- request synchronization error
|
||||
-- (for both variants of followed CREATE INDEX statement)
|
||||
|
||||
set planonly;
|
||||
|
||||
|
||||
select * from t where coalesce(n*2,0) = 0;
|
||||
select * from t where decode( mod(n, 3), 0, coalesce(n,0), 1, iif(mod(n,7)=0, 2, 3) ) = 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 (T_N2_COALESCE))
|
||||
PLAN (T INDEX (T_N2_DECODE))
|
||||
"""
|
||||
|
||||
@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_3340
|
||||
# title: Error in autonomous transaction with empty exception handler: can insert duplicate values into PK/UK column (leads to unrestorable backup)
|
||||
# decription:
|
||||
# tracker_id: CORE-3340
|
||||
# min_versions: ['2.5.1']
|
||||
# versions: 3.0
|
||||
# qmid: None
|
||||
|
||||
"""
|
||||
ID: issue-3706
|
||||
ISSUE: 3706
|
||||
TITLE: Error in autonomous transaction with empty exception handler: can insert duplicate values into PK/UK column (leads to unrestorable backup)
|
||||
DESCRIPTION:
|
||||
JIRA: CORE-3340
|
||||
"""
|
||||
|
||||
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 = """recreate table tmp(id int not null primary key using index tmp_id_pk);
|
||||
init_script = """recreate table tmp(id int not null primary key using index tmp_id_pk);
|
||||
commit;
|
||||
set transaction no wait isolation level read committed;
|
||||
set term ^;
|
||||
@ -35,15 +30,15 @@ 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 id from tmp;
|
||||
test_script = """select id from tmp;
|
||||
select count(*) from tmp;
|
||||
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
|
||||
@ -57,8 +52,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,29 +1,24 @@
|
||||
#coding:utf-8
|
||||
#
|
||||
# id: bugs.core_3343
|
||||
# title: RETURNING clause is not supported in positioned (WHERE CURRENT OF) UPDATE and DELETE statements
|
||||
# decription:
|
||||
# tracker_id: CORE-3343
|
||||
# min_versions: ['3.0']
|
||||
# versions: 3.0
|
||||
# qmid: None
|
||||
|
||||
"""
|
||||
ID: issue-3709
|
||||
ISSUE: 3709
|
||||
TITLE: RETURNING clause is not supported in positioned (WHERE CURRENT OF) UPDATE and DELETE statements
|
||||
DESCRIPTION:
|
||||
JIRA: CORE-3343
|
||||
"""
|
||||
|
||||
import pytest
|
||||
from firebird.qa import db_factory, isql_act, Action
|
||||
from firebird.qa import *
|
||||
|
||||
# version: 3.0
|
||||
# resources: None
|
||||
|
||||
substitutions_1 = [('VB_.*', '')]
|
||||
|
||||
init_script_1 = """
|
||||
init_script = """
|
||||
recreate table test_a(id integer, cnt integer);
|
||||
commit;
|
||||
"""
|
||||
|
||||
db_1 = db_factory(sql_dialect=3, init=init_script_1)
|
||||
db = db_factory(init=init_script)
|
||||
|
||||
test_script_1 = """
|
||||
test_script = """
|
||||
set term ^;
|
||||
execute block
|
||||
as
|
||||
@ -38,7 +33,7 @@ test_script_1 = """
|
||||
where current of c
|
||||
returning cnt into :cnt;
|
||||
end
|
||||
end
|
||||
end
|
||||
^
|
||||
set term ;^
|
||||
commit;
|
||||
@ -64,8 +59,8 @@ test_script_1 = """
|
||||
begin
|
||||
fetch c into :v_s;
|
||||
if (row_count = 0) then leave;
|
||||
update test set b = reverse(b)
|
||||
where current of c
|
||||
update test set b = reverse(b)
|
||||
where current of c
|
||||
returning upper(old.b), upper(new.b) into vb_old, vb_new
|
||||
;
|
||||
suspend;
|
||||
@ -78,16 +73,16 @@ test_script_1 = """
|
||||
|
||||
"""
|
||||
|
||||
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
|
||||
act = isql_act('db', test_script, substitutions=[('VB_.*', '')])
|
||||
|
||||
expected_stdout_1 = """
|
||||
expected_stdout = """
|
||||
QWE
|
||||
EWQ
|
||||
"""
|
||||
|
||||
@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_3353
|
||||
# title: Predicate (blob_field LIKE ?) describes the parameter as VARCHAR(30) rather than as BLOB
|
||||
# decription:
|
||||
# tracker_id: CORE-3353
|
||||
# min_versions: ['2.5.1']
|
||||
# versions: 3.0, 4.0
|
||||
# qmid: None
|
||||
|
||||
"""
|
||||
ID: issue-3719
|
||||
ISSUE: 3719
|
||||
TITLE: Predicate (blob_field LIKE ?) describes the parameter as VARCHAR(30) rather than as BLOB
|
||||
DESCRIPTION:
|
||||
JIRA: CORE-3353
|
||||
"""
|
||||
|
||||
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]*', ' ')]
|
||||
|
||||
init_script_1 = """"""
|
||||
|
||||
db_1 = db_factory(sql_dialect=3, init=init_script_1)
|
||||
|
||||
test_script_1 = """
|
||||
test_script = """
|
||||
set sqlda_display on;
|
||||
set planonly;
|
||||
select rdb$procedure_source from rdb$procedures where rdb$procedure_source like ?;
|
||||
@ -29,7 +22,9 @@ test_script_1 = """
|
||||
-- (see also: core_4156.fbt)
|
||||
"""
|
||||
|
||||
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
|
||||
act = isql_act('db', test_script, substitutions=[('^((?!sqltype).)*$', ''), ('[ ]+', ' '), ('[\t]*', ' ')])
|
||||
|
||||
# version: 3.0
|
||||
|
||||
expected_stdout_1 = """
|
||||
01: sqltype: 520 BLOB Nullable scale: 0 subtype: 1 len: 8 charset: 4 UTF8
|
||||
@ -37,30 +32,12 @@ expected_stdout_1 = """
|
||||
"""
|
||||
|
||||
@pytest.mark.version('>=3.0,<4.0')
|
||||
def test_1(act_1: Action):
|
||||
act_1.expected_stdout = expected_stdout_1
|
||||
act_1.execute(charset='utf8')
|
||||
assert act_1.clean_stdout == act_1.clean_expected_stdout
|
||||
def test_1(act: Action):
|
||||
act.expected_stdout = expected_stdout_1
|
||||
act.execute(charset='utf8')
|
||||
assert act.clean_stdout == act.clean_expected_stdout
|
||||
|
||||
# version: 4.0
|
||||
# resources: None
|
||||
|
||||
substitutions_2 = [('^((?!sqltype).)*$', ''), ('[ ]+', ' '), ('[\t]*', ' ')]
|
||||
|
||||
init_script_2 = """"""
|
||||
|
||||
db_2 = db_factory(sql_dialect=3, init=init_script_2)
|
||||
|
||||
test_script_2 = """
|
||||
set sqlda_display on;
|
||||
set planonly;
|
||||
select rdb$procedure_source from rdb$procedures where rdb$procedure_source like ?;
|
||||
-- NB: output in 3.0 will contain values of sqltype with ZERO in bit_0,
|
||||
-- so it will be: 520 instead of previous 521.
|
||||
-- (see also: core_4156.fbt)
|
||||
"""
|
||||
|
||||
act_2 = isql_act('db_2', test_script_2, substitutions=substitutions_2)
|
||||
|
||||
expected_stdout_2 = """
|
||||
01: sqltype: 520 BLOB Nullable scale: 0 subtype: 1 len: 8 charset: 4 UTF8
|
||||
@ -68,8 +45,8 @@ expected_stdout_2 = """
|
||||
"""
|
||||
|
||||
@pytest.mark.version('>=4.0')
|
||||
def test_2(act_2: Action):
|
||||
act_2.expected_stdout = expected_stdout_2
|
||||
act_2.execute()
|
||||
assert act_2.clean_stdout == act_2.clean_expected_stdout
|
||||
def test_2(act: Action):
|
||||
act.expected_stdout = expected_stdout_2
|
||||
act.execute()
|
||||
assert act.clean_stdout == act.clean_expected_stdout
|
||||
|
||||
|
@ -1,22 +1,17 @@
|
||||
#coding:utf-8
|
||||
#
|
||||
# id: bugs.core_3355
|
||||
# title: Wrong comparsion of DATE and TIMESTAMP if index is used
|
||||
# decription:
|
||||
# tracker_id: CORE-3355
|
||||
# min_versions: ['2.1.5']
|
||||
# versions: 3.0
|
||||
# qmid: None
|
||||
|
||||
"""
|
||||
ID: issue-3721
|
||||
ISSUE: 3721
|
||||
TITLE: Wrong comparsion of DATE and TIMESTAMP if index is used
|
||||
DESCRIPTION:
|
||||
JIRA: CORE-3355
|
||||
"""
|
||||
|
||||
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 tdate (id integer not null primary key, val date);
|
||||
init_script = """create table tdate (id integer not null primary key, val date);
|
||||
create index tdateix1 on tdate (val);
|
||||
commit;
|
||||
insert into tdate values (0, '1997-12-31');
|
||||
@ -28,15 +23,15 @@ insert into tdate values (5, '1998-01-05');
|
||||
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 count(*) from tdate where val >= timestamp'1998-01-04 12:00:00.0000';
|
||||
test_script = """select count(*) from tdate where val >= timestamp'1998-01-04 12:00:00.0000';
|
||||
select count(*) from tdate where val < timestamp'1998-01-04 12:00:00.0000';
|
||||
"""
|
||||
|
||||
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
|
||||
act = isql_act('db', test_script)
|
||||
|
||||
expected_stdout_1 = """
|
||||
expected_stdout = """
|
||||
COUNT
|
||||
=====================
|
||||
1
|
||||
@ -45,12 +40,11 @@ expected_stdout_1 = """
|
||||
COUNT
|
||||
=====================
|
||||
5
|
||||
|
||||
"""
|
||||
|
||||
@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,122 +1,53 @@
|
||||
#coding:utf-8
|
||||
#
|
||||
# id: bugs.core_3357
|
||||
# title: Generators are set to 0 after restore
|
||||
# decription:
|
||||
# NOTE: FB 4.x has incompatible behaviour with all previous versions since build 4.0.0.2131 (06-aug-2020):
|
||||
# statement 'alter sequence <seq_name> restart with 0' changes rdb$generators.rdb$initial_value to -1 thus
|
||||
# next call of gen_id(<seq_name>,1) will return 0 (ZERO!) rather than 1.
|
||||
# See also CORE-6084 and its fix: https://github.com/FirebirdSQL/firebird/commit/23dc0c6297825b2e9006f4d5a2c488702091033d
|
||||
# This is considered as *expected* and is noted in doc/README.incompatibilities.3to4.txt
|
||||
#
|
||||
# Because of this it was decided to create separate section for check FB 4.x results.
|
||||
# Checked on 4.0.0.2164
|
||||
#
|
||||
# tracker_id: CORE-3357
|
||||
# min_versions: ['2.5.0']
|
||||
# versions: 3.0, 4.0
|
||||
# qmid: None
|
||||
|
||||
"""
|
||||
ID: issue-3723
|
||||
ISSUE: 3723
|
||||
TITLE: Generators are set to 0 after restore
|
||||
DESCRIPTION:
|
||||
FB 4.x has incompatible behaviour with all previous versions since build 4.0.0.2131 (06-aug-2020):
|
||||
statement 'alter sequence <seq_name> restart with 0' changes rdb$generators.rdb$initial_value to -1 thus
|
||||
next call of gen_id(<seq_name>,1) will return 0 (ZERO!) rather than 1.
|
||||
See also CORE-6084 and its fix: https://github.com/FirebirdSQL/firebird/commit/23dc0c6297825b2e9006f4d5a2c488702091033d
|
||||
This is considered as *expected* and is noted in doc/README.incompatibilities.3to4.txt
|
||||
JIRA: CORE-3357
|
||||
"""
|
||||
|
||||
import pytest
|
||||
from io import BytesIO
|
||||
from firebird.qa import db_factory, python_act, Action
|
||||
from firebird.qa import *
|
||||
from firebird.driver import SrvRestoreFlag
|
||||
|
||||
# version: 3.0
|
||||
# resources: None
|
||||
|
||||
substitutions_1 = []
|
||||
|
||||
init_script_1 = """
|
||||
init_script = """
|
||||
recreate sequence g1 start with 9223372036854775807 increment by -2147483647;
|
||||
recreate sequence g2 start with -9223372036854775808 increment by 2147483647;
|
||||
commit;
|
||||
"""
|
||||
|
||||
db_1 = db_factory(sql_dialect=3, init=init_script_1)
|
||||
db = db_factory(init=init_script)
|
||||
|
||||
# test_script_1
|
||||
#---
|
||||
# import os
|
||||
# db_conn.close()
|
||||
# fbk = os.path.join(context['temp_directory'],'tmp.core_3942.fbk')
|
||||
# runProgram('gbak',['-b','-user',user_name,'-password',user_password,dsn,fbk])
|
||||
# runProgram('gbak',['-rep','-user',user_name,'-password',user_password,fbk,dsn])
|
||||
# sql='''show sequ g1;
|
||||
# show sequ g2;
|
||||
# '''
|
||||
# runProgram('isql',[dsn,'-user',user_name,'-pas',user_password],sql)
|
||||
#
|
||||
# if os.path.isfile(fbk):
|
||||
# os.remove(fbk)
|
||||
#---
|
||||
act = python_act('db')
|
||||
|
||||
act_1 = python_act('db_1', substitutions=substitutions_1)
|
||||
|
||||
expected_stdout_1 = """
|
||||
# version: 3.0
|
||||
expected_stdout_3 = """
|
||||
Generator G1, current value: 9223372036854775807, initial value: 9223372036854775807, increment: -2147483647
|
||||
Generator G2, current value: -9223372036854775808, initial value: -9223372036854775808, increment: 2147483647
|
||||
"""
|
||||
|
||||
@pytest.mark.version('>=3.0,<4')
|
||||
def test_1(act_1: Action):
|
||||
with act_1.connect_server() as srv:
|
||||
backup = BytesIO()
|
||||
srv.database.local_backup(database=act_1.db.db_path, backup_stream=backup)
|
||||
backup.seek(0)
|
||||
srv.database.local_restore(backup_stream=backup, database=act_1.db.db_path,
|
||||
flags=SrvRestoreFlag.REPLACE)
|
||||
act_1.expected_stdout = expected_stdout_1
|
||||
act_1.isql(switches=[], input="show sequ g1; show sequ g2;")
|
||||
assert act_1.clean_stdout == act_1.clean_expected_stdout
|
||||
|
||||
|
||||
# version: 4.0
|
||||
# resources: None
|
||||
|
||||
substitutions_2 = []
|
||||
|
||||
init_script_2 = """
|
||||
recreate sequence g1 start with 9223372036854775807 increment by -2147483647;
|
||||
recreate sequence g2 start with -9223372036854775808 increment by 2147483647;
|
||||
commit;
|
||||
"""
|
||||
|
||||
db_2 = db_factory(sql_dialect=3, init=init_script_2)
|
||||
|
||||
# test_script_2
|
||||
#---
|
||||
# import os
|
||||
# db_conn.close()
|
||||
# fbk = os.path.join(context['temp_directory'],'tmp.core_3942.fbk')
|
||||
# runProgram('gbak',['-b','-user',user_name,'-password',user_password,dsn,fbk])
|
||||
# runProgram('gbak',['-rep','-user',user_name,'-password',user_password,fbk,dsn])
|
||||
# sql='''show sequ g1;
|
||||
# show sequ g2;
|
||||
# '''
|
||||
# runProgram('isql',[dsn,'-user',user_name,'-pas',user_password],sql)
|
||||
#
|
||||
# if os.path.isfile(fbk):
|
||||
# os.remove(fbk)
|
||||
#---
|
||||
|
||||
act_2 = python_act('db_2', substitutions=substitutions_2)
|
||||
|
||||
expected_stdout_2 = """
|
||||
expected_stdout_4 = """
|
||||
Generator G1, current value: -9223372034707292162, initial value: 9223372036854775807, increment: -2147483647
|
||||
Generator G2, current value: 9223372034707292161, initial value: -9223372036854775808, increment: 2147483647
|
||||
"""
|
||||
|
||||
@pytest.mark.version('>=4.0')
|
||||
def test_2(act_2: Action):
|
||||
with act_2.connect_server() as srv:
|
||||
@pytest.mark.version('>=3.0')
|
||||
def test_1(act: Action):
|
||||
with act.connect_server() as srv:
|
||||
backup = BytesIO()
|
||||
srv.database.local_backup(database=act_2.db.db_path, backup_stream=backup)
|
||||
srv.database.local_backup(database=act.db.db_path, backup_stream=backup)
|
||||
backup.seek(0)
|
||||
srv.database.local_restore(backup_stream=backup, database=act_2.db.db_path,
|
||||
srv.database.local_restore(backup_stream=backup, database=act.db.db_path,
|
||||
flags=SrvRestoreFlag.REPLACE)
|
||||
act_2.expected_stdout = expected_stdout_2
|
||||
act_2.isql(switches=[], input="show sequ g1; show sequ g2;")
|
||||
assert act_2.clean_stdout == act_2.clean_expected_stdout
|
||||
|
||||
|
||||
act.expected_stdout = expected_stdout_4 if act.is_version('>=4') else expected_stdout_3
|
||||
act.isql(switches=[], input="show sequ g1; show sequ g2;")
|
||||
assert act.clean_stdout == act.clean_expected_stdout
|
||||
|
@ -1,75 +1,49 @@
|
||||
#coding:utf-8
|
||||
#
|
||||
# id: bugs.core_3360
|
||||
# title: update ... returning ... raises -551 (no perm to update) for a column present only in the returning clause
|
||||
# decription:
|
||||
# tracker_id: CORE-3360
|
||||
# min_versions: ['2.5.3']
|
||||
# versions: 2.5.3
|
||||
# qmid: None
|
||||
|
||||
"""
|
||||
ID: issue-3726
|
||||
ISSUE: 3726
|
||||
TITLE: update ... returning ... raises -551 (no perm to update) for a column present only in the returning clause
|
||||
DESCRIPTION:
|
||||
JIRA: CORE-3360
|
||||
"""
|
||||
|
||||
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 = """
|
||||
test_script = """
|
||||
set list on;
|
||||
set wng off;
|
||||
|
||||
-- Drop old account with name = 'tmp$c3360' if it remains from prevoius run:
|
||||
set term ^;
|
||||
execute block as
|
||||
begin
|
||||
begin
|
||||
execute statement 'drop user tmp$c3360' with autonomous transaction;
|
||||
when any do begin end
|
||||
end
|
||||
end^
|
||||
set term ;^
|
||||
recreate table test(id int, readonly_x int, readonly_y int, writeable_column int);
|
||||
commit;
|
||||
|
||||
create user tmp$c3360 password '123';
|
||||
commit;
|
||||
revoke all on all from tmp$c3360;
|
||||
commit;
|
||||
|
||||
recreate table test(id int, readonly_x int, readonly_y int, writeable_column int);
|
||||
commit;
|
||||
|
||||
insert into test(id, readonly_x, readonly_y, writeable_column) values(1, 100, 200, 300);
|
||||
insert into test(id, readonly_x, readonly_y, writeable_column) values(1, 100, 200, 300);
|
||||
commit;
|
||||
|
||||
grant select on test to tmp$c3360;
|
||||
grant update (writeable_column) on test to tmp$c3360;
|
||||
commit;
|
||||
commit;
|
||||
|
||||
connect '$(DSN)' user 'TMP$C3360' password '123';
|
||||
|
||||
update test set writeable_column = readonly_x - readonly_y where id = 1 returning writeable_column;
|
||||
commit;
|
||||
|
||||
connect '$(DSN)' user 'SYSDBA' password 'masterkey';
|
||||
drop user tmp$c3360;
|
||||
commit;
|
||||
"""
|
||||
|
||||
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
|
||||
act = isql_act('db', test_script)
|
||||
|
||||
expected_stdout_1 = """
|
||||
test_user = user_factory('db', name='tmp$c3360', password='123')
|
||||
|
||||
expected_stdout = """
|
||||
WRITEABLE_COLUMN -100
|
||||
"""
|
||||
|
||||
@pytest.mark.version('>=2.5.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, test_user: User):
|
||||
act.expected_stdout = expected_stdout
|
||||
act.execute()
|
||||
assert act.clean_stdout == act.clean_expected_stdout
|
||||
|
||||
|
@ -1,44 +1,31 @@
|
||||
#coding:utf-8
|
||||
#
|
||||
# id: bugs.core_3362_basic
|
||||
# title: Cursors should ignore changes made by the same statement
|
||||
# decription:
|
||||
# This test verifies BASIC issues that were accumulated in miscenaleous tickets.
|
||||
# More complex cases (which involve not only SQL but also PSQL features) will
|
||||
# follow in separate .fbt(s) in order to keep size of each test in reasonable limits.
|
||||
# Checked on WI-T4.0.0.371, WI-V3.0.1.32597.
|
||||
# Checked on 4.0.0.2028 (after fix core-2274) -- see below, view v_t1_updatable.
|
||||
#
|
||||
# :::::::::::::::::::::::::::::::::::::::: NB ::::::::::::::::::::::::::::::::::::
|
||||
# 18.08.2020. FB 4.x has incompatible behaviour with all previous versions since build 4.0.0.2131 (06-aug-2020):
|
||||
# statement 'alter sequence <seq_name> restart with 0' changes rdb$generators.rdb$initial_value to -1 thus next call
|
||||
# gen_id(<seq_name>,1) will return 0 (ZERO!) rather than 1.
|
||||
# See also CORE-6084 and its fix: https://github.com/FirebirdSQL/firebird/commit/23dc0c6297825b2e9006f4d5a2c488702091033d
|
||||
# ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
|
||||
# This is considered as *expected* and is noted in doc/README.incompatibilities.3to4.txt
|
||||
#
|
||||
# Because of this, it was decided to replace 'alter sequence restart...' with subtraction of two gen values:
|
||||
# c = gen_id(<g>, -gen_id(<g>, 0)) -- see procedure sp_restart_sequences.
|
||||
#
|
||||
#
|
||||
# tracker_id: CORE-3362
|
||||
# min_versions: ['3.0.1']
|
||||
# versions: 3.0.1
|
||||
# qmid: None
|
||||
|
||||
"""
|
||||
ID: issue-3728-basic
|
||||
ISSUE: 3728
|
||||
TITLE: Cursors should ignore changes made by the same statement
|
||||
DESCRIPTION:
|
||||
This test verifies BASIC issues that were accumulated in miscenaleous tickets.
|
||||
More complex cases (which involve not only SQL but also PSQL features) will
|
||||
follow in separate .fbt(s) in order to keep size of each test in reasonable limits.
|
||||
NOTES:
|
||||
[18.08.2020]
|
||||
FB 4.x has incompatible behaviour with all previous versions since build 4.0.0.2131 (06-aug-2020):
|
||||
statement 'alter sequence <seq_name> restart with 0' changes rdb$generators.rdb$initial_value to -1 thus next call
|
||||
gen_id(<seq_name>,1) will return 0 (ZERO!) rather than 1.
|
||||
See also CORE-6084 and its fix: https://github.com/FirebirdSQL/firebird/commit/23dc0c6297825b2e9006f4d5a2c488702091033d
|
||||
This is considered as *expected* and is noted in doc/README.incompatibilities.3to4.txt
|
||||
Because of this, it was decided to replace 'alter sequence restart...' with subtraction of two gen values:
|
||||
c = gen_id(<g>, -gen_id(<g>, 0)) -- see procedure sp_restart_sequences.
|
||||
JIRA: CORE-3362
|
||||
"""
|
||||
|
||||
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 = """
|
||||
create or alter procedure sp_restart_sequences as begin end;
|
||||
set term ^;
|
||||
execute block as
|
||||
@ -140,7 +127,7 @@ test_script_1 = """
|
||||
insert into test values(2, 'green');
|
||||
insert into test values(3, 'blue');
|
||||
insert into test values(2, 'green');
|
||||
|
||||
|
||||
delete from test
|
||||
where test.ID in (select id from test GROUP BY id HAVING count(id)>1);
|
||||
|
||||
@ -258,7 +245,7 @@ test_script_1 = """
|
||||
constraint cls_ui1_c unique(id_parent, depth, id_child),
|
||||
constraint cls_ui2_c unique(id_child, id_parent),
|
||||
constraint cls_pk_c primary key (id)
|
||||
);
|
||||
);
|
||||
commit;
|
||||
|
||||
insert into cls values(1, 2, 2, 0);
|
||||
@ -267,7 +254,7 @@ test_script_1 = """
|
||||
insert into cls values(4, 2, 7, 1);
|
||||
insert into cls values(5, 2, 10, 2);
|
||||
insert into cls values(6, 7, 10, 1);
|
||||
commit;
|
||||
commit;
|
||||
|
||||
delete
|
||||
from cls
|
||||
@ -330,9 +317,9 @@ test_script_1 = """
|
||||
insert into t values(1, 100);
|
||||
insert into t values(2, 200);
|
||||
insert into t values(3, 300);
|
||||
commit;
|
||||
commit;
|
||||
|
||||
update t set f01=(select sum(f01) from t);
|
||||
update t set f01=(select sum(f01) from t);
|
||||
|
||||
set count on;
|
||||
select 'core-3362, case-1' as test_case, t.* from t order by id;
|
||||
@ -371,9 +358,9 @@ test_script_1 = """
|
||||
insert into t values(1, 300);
|
||||
insert into t values(2, 200);
|
||||
insert into t values(3, 100);
|
||||
commit;
|
||||
commit;
|
||||
|
||||
update t set f01=(select sum(f01) from t);
|
||||
update t set f01=(select sum(f01) from t);
|
||||
|
||||
set count on;
|
||||
select 'core-3362, case-2' as test_case, t.* from t;
|
||||
@ -402,7 +389,7 @@ test_script_1 = """
|
||||
--###########################################################################
|
||||
|
||||
|
||||
-- Issue of 03.01.2014 05:07.
|
||||
-- Issue of 03.01.2014 05:07.
|
||||
recreate table t(
|
||||
i int,
|
||||
x int, y int,
|
||||
@ -421,7 +408,7 @@ test_script_1 = """
|
||||
commit;
|
||||
-- select * from t;
|
||||
|
||||
update t set x=y+1;
|
||||
update t set x=y+1;
|
||||
|
||||
set count on;
|
||||
select 'core-3362, case-3' as test_case, t.* from t order by i;
|
||||
@ -470,7 +457,7 @@ test_script_1 = """
|
||||
insert into t values(3, 3);
|
||||
insert into t values(4, 4);
|
||||
insert into t values(5, 5);
|
||||
commit;
|
||||
commit;
|
||||
|
||||
update t set x=null, y=(select c from (select count(x)over() c from t) rows 1);
|
||||
|
||||
@ -483,7 +470,7 @@ test_script_1 = """
|
||||
commit;
|
||||
|
||||
/********************************
|
||||
Expected output
|
||||
Expected output
|
||||
X <null>
|
||||
Y 5
|
||||
|
||||
@ -569,7 +556,7 @@ test_script_1 = """
|
||||
insert into t values(1,0);
|
||||
commit;
|
||||
|
||||
delete from t m where (select count(*)over() from t x where x.y=m.y rows 1) > 1;
|
||||
delete from t m where (select count(*)over() from t x where x.y=m.y rows 1) > 1;
|
||||
|
||||
set count on;
|
||||
select 'core-3362, case-6' as test_case, t.* from t;
|
||||
@ -637,10 +624,10 @@ test_script_1 = """
|
||||
insert into t values(2, 200);
|
||||
insert into t values(3, 300);
|
||||
commit;
|
||||
create view v as select y,count(*) cnt from t group by y;
|
||||
create view v as select y,count(*) cnt from t group by y;
|
||||
commit;
|
||||
|
||||
update t set y=null where 2 not in( select cnt from v );
|
||||
update t set y=null where 2 not in( select cnt from v );
|
||||
|
||||
set count on;
|
||||
select 'core-3362, case-8.1' as test_case, t.* from t;
|
||||
@ -720,7 +707,7 @@ test_script_1 = """
|
||||
insert into t values(4, 2);
|
||||
insert into t values(5, 1);
|
||||
|
||||
recreate table t2(x int, y int);
|
||||
recreate table t2(x int, y int);
|
||||
|
||||
insert into t2 values(2, 4);
|
||||
insert into t2 values(5, 1);
|
||||
@ -728,7 +715,7 @@ test_script_1 = """
|
||||
insert into t2 values(4, 2);
|
||||
insert into t2 values(3, 3);
|
||||
|
||||
-- This is only for illustrate required result: all rows should contain
|
||||
-- This is only for illustrate required result: all rows should contain
|
||||
-- new value y = 4
|
||||
-- update t set t.y = (select count(*) from t where x<>y)
|
||||
-- where exists( select * from t2 s where t.x=s.y)
|
||||
@ -737,7 +724,7 @@ test_script_1 = """
|
||||
|
||||
merge into t using(select x,y from t2) s on t.x=s.y
|
||||
when matched
|
||||
then update set t.y=(select count(*) from t where x<>y);
|
||||
then update set t.y=(select count(*) from t where x<>y);
|
||||
|
||||
--set list off;
|
||||
set count on;
|
||||
@ -764,7 +751,7 @@ test_script_1 = """
|
||||
Records affected: 5
|
||||
*********************************/
|
||||
|
||||
-- Result:
|
||||
-- Result:
|
||||
-- OK on WI-T4.0.0.371, WI-V3.0.1.32597; 2.5.x: wrong data in t.y: {4,4,4,5,5}
|
||||
-- 3.0.0.32030 = FAIL <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< F A I L <<<<<<<<<<<<<<
|
||||
-- 3.0.0.32362 = OK. // confirmed on: WI-V3.0.0.32362, 26.02.2016
|
||||
@ -795,7 +782,7 @@ test_script_1 = """
|
||||
update test set pid=1 where id=5;
|
||||
commit;
|
||||
|
||||
/*
|
||||
/*
|
||||
content of table test now is:
|
||||
ID PID
|
||||
5 1
|
||||
@ -848,46 +835,46 @@ test_script_1 = """
|
||||
commit;
|
||||
|
||||
merge into t2 using t1 on t1.id=t2.id when not matched then insert (id, x) values(t1.id, (select sum(id) from t2) );
|
||||
select 'core-3362, case-11a' as test_case, a.* from t2 a;
|
||||
select 'core-3362, case-11a' as test_case, a.* from t2 a;
|
||||
rollback;
|
||||
|
||||
merge into t2 using t1 on t1.id=t2.id when not matched then insert (id, x) values(t1.id, (select min(id) from t2) );
|
||||
select 'core-3362, case-11b' as test_case, a.* from t2 a;
|
||||
select 'core-3362, case-11b' as test_case, a.* from t2 a;
|
||||
rollback;
|
||||
|
||||
merge into t2 using t1 on t1.id=t2.id when not matched then insert (id, x) values(t1.id, (select max(id) from t2) );
|
||||
select 'core-3362, case-11c' as test_case, a.* from t2 a;
|
||||
select 'core-3362, case-11c' as test_case, a.* from t2 a;
|
||||
rollback;
|
||||
|
||||
merge into t2 using t1 on t1.id=t2.id when not matched then insert (id, x) values(t1.id, (select count(*) from t2) );
|
||||
select 'core-3362, case-11d' as test_case, a.* from t2 a;
|
||||
select 'core-3362, case-11d' as test_case, a.* from t2 a;
|
||||
rollback;
|
||||
|
||||
/*
|
||||
Expected result:
|
||||
ID X
|
||||
============ ============
|
||||
1 <null>
|
||||
2 <null>
|
||||
3 <null>
|
||||
ID X
|
||||
============ ============
|
||||
1 <null>
|
||||
2 <null>
|
||||
3 <null>
|
||||
|
||||
ID X
|
||||
============ ============
|
||||
1 <null>
|
||||
2 <null>
|
||||
3 <null>
|
||||
ID X
|
||||
============ ============
|
||||
1 <null>
|
||||
2 <null>
|
||||
3 <null>
|
||||
|
||||
ID X
|
||||
============ ============
|
||||
1 <null>
|
||||
2 <null>
|
||||
3 <null>
|
||||
ID X
|
||||
============ ============
|
||||
1 <null>
|
||||
2 <null>
|
||||
3 <null>
|
||||
|
||||
ID X
|
||||
============ ============
|
||||
1 0
|
||||
2 0
|
||||
3 0
|
||||
ID X
|
||||
============ ============
|
||||
1 0
|
||||
2 0
|
||||
3 0
|
||||
*/
|
||||
-- OK on WI-T4.0.0.371, WI-V3.0.1.32597; totally wrong on 2.5.x
|
||||
|
||||
@ -901,7 +888,7 @@ test_script_1 = """
|
||||
--recreate view v_t1_checked as select * from t1 where true with check option; -- temply (?) added 07.06.2020 because of fixed core-2274
|
||||
|
||||
-- 08.06.2020: 'WITH CHECK OPTION' no more helps.
|
||||
-- We have to create 'truly-updatable' view in order to avoid
|
||||
-- We have to create 'truly-updatable' view in order to avoid
|
||||
-- Statement failed, SQLSTATE = 21000
|
||||
-- Multiple source records cannot match the same target during MERGE
|
||||
recreate view v_t1_updatable as select * from t1;
|
||||
@ -936,12 +923,12 @@ test_script_1 = """
|
||||
|
||||
|
||||
merge into v_t1_updatable t
|
||||
using t1 s on
|
||||
using t1 s on
|
||||
t.x not in ( select x from t1 z where z.x is null or z.x > all(select x from t1 y where y.id<>z.id ) )
|
||||
when matched then update set x = null
|
||||
;
|
||||
|
||||
select 'core-3362, case-12a' as test_case, a.* from t1 a;
|
||||
select 'core-3362, case-12a' as test_case, a.* from t1 a;
|
||||
|
||||
/* Expected result:
|
||||
ID 1
|
||||
@ -962,12 +949,12 @@ test_script_1 = """
|
||||
|
||||
|
||||
merge into v_t1_updatable t
|
||||
using t1 s on
|
||||
using t1 s on
|
||||
t.x not in ( select x from t1 z where z.x is null or z.x > all(select x from t1 y where y.id<>z.id ) )
|
||||
when matched then update set x = null
|
||||
;
|
||||
|
||||
select 'core-3362, case-12b' as test_case, a.* from t1 a;
|
||||
select 'core-3362, case-12b' as test_case, a.* from t1 a;
|
||||
/* Expected result:
|
||||
ID 1
|
||||
X <null>
|
||||
@ -987,7 +974,7 @@ test_script_1 = """
|
||||
|
||||
|
||||
--###########################################################################
|
||||
|
||||
|
||||
-- 24.10.2016 from CORE-3862:
|
||||
|
||||
recreate table icesling (
|
||||
@ -1020,9 +1007,9 @@ 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 = """
|
||||
TEST_CASE core-92
|
||||
X 0
|
||||
|
||||
@ -1052,11 +1039,11 @@ expected_stdout_1 = """
|
||||
|
||||
TEST_CASE core-634, case-2
|
||||
ID 1
|
||||
VAL red
|
||||
VAL red
|
||||
|
||||
TEST_CASE core-634, case-2
|
||||
ID 3
|
||||
VAL blue
|
||||
VAL blue
|
||||
|
||||
|
||||
Records affected: 2
|
||||
@ -1427,8 +1414,8 @@ expected_stdout_1 = """
|
||||
"""
|
||||
|
||||
@pytest.mark.version('>=3.0.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,34 +1,29 @@
|
||||
#coding:utf-8
|
||||
#
|
||||
# id: bugs.core_3362_complex
|
||||
# title: Cursors should ignore changes made by the same statement
|
||||
# decription:
|
||||
# This test verifies PSQL issues that were accumulated in miscenaleous tickets.
|
||||
#
|
||||
# 02.05.2021: created separate code for FB 4.x because of fixed GH-6778
|
||||
# (see https://github.com/FirebirdSQL/firebird/issues/6778 for details).
|
||||
# NB: final UPDATE statement (which is after DELETE one) must NOT issue exception
|
||||
# in FB 4.x, so the record deletion will not undone and we can not see table data
|
||||
# in expected_stdout for FB 4.x!
|
||||
#
|
||||
# Checked on 4.0.0.2451
|
||||
#
|
||||
# tracker_id: CORE-3362
|
||||
# min_versions: ['3.0.1']
|
||||
# versions: 3.0.1, 4.0
|
||||
# qmid: None
|
||||
|
||||
"""
|
||||
ID: issue-3728-complex
|
||||
ISSUE: 3728
|
||||
TITLE: Incorrect results when left join on subquery with constant column
|
||||
DESCRIPTION:
|
||||
This test verifies PSQL issues that were accumulated in miscenaleous tickets.
|
||||
NOTES:
|
||||
[02.05.2021]
|
||||
created separate code for FB 4.x because of fixed #6778
|
||||
(see https://github.com/FirebirdSQL/firebird/issues/6778 for details).
|
||||
NB: final UPDATE statement (which is after DELETE one) must NOT issue exception
|
||||
in FB 4.x, so the record deletion will not undone and we can not see table data
|
||||
in expected_stdout for FB 4.x!
|
||||
JIRA: CORE-3362
|
||||
"""
|
||||
|
||||
import pytest
|
||||
from firebird.qa import db_factory, isql_act, Action
|
||||
from firebird.qa import *
|
||||
|
||||
substitutions = [('[ \t]+', ' '), ('line: [\\d]+[,]{0,1} col: [\\d]+', '')]
|
||||
|
||||
db = db_factory()
|
||||
|
||||
# version: 3.0.1
|
||||
# resources: None
|
||||
|
||||
substitutions_1 = [('[ \t]+', ' '), ('line: [\\d]+[,]{0,1} col: [\\d]+', '')]
|
||||
|
||||
init_script_1 = """"""
|
||||
|
||||
db_1 = db_factory(sql_dialect=3, init=init_script_1)
|
||||
|
||||
test_script_1 = """
|
||||
-- see also:
|
||||
@ -45,13 +40,13 @@ test_script_1 = """
|
||||
create or alter procedure sp_set_ctx(a_point varchar(20), a_data1 int, a_data2 int, a_data3 int, a_data4 int) as
|
||||
begin
|
||||
-- Store values of cursor fields in the context variable which name is passed here as 'a_point'.
|
||||
rdb$set_context(
|
||||
'USER_SESSION',
|
||||
rdb$set_context(
|
||||
'USER_SESSION',
|
||||
a_point,
|
||||
coalesce(cast( a_data1 as char(6)),'#null#')
|
||||
coalesce(cast( a_data1 as char(6)),'#null#')
|
||||
|| ' ' || coalesce(cast( a_data2 as char(6)),'#null#')
|
||||
|| ' ' || coalesce(cast( a_data3 as char(6)),'#null#')
|
||||
|| ' ' || coalesce(cast( a_data4 as char(6)),'#null#')
|
||||
|| ' ' || coalesce(cast( a_data4 as char(6)),'#null#')
|
||||
);
|
||||
end
|
||||
^
|
||||
@ -64,10 +59,10 @@ test_script_1 = """
|
||||
-- Do _NOT_ try to check following statements using explicit cursor
|
||||
-- (i.e. OPEN <C>; FETCH ...; CLOSE <C>)
|
||||
for
|
||||
select t.id, t.data1, t.data2, t.data3, t.data4 from test t where t.id = 1
|
||||
select t.id, t.data1, t.data2, t.data3, t.data4 from test t where t.id = 1
|
||||
as cursor c
|
||||
do begin
|
||||
|
||||
|
||||
execute procedure sp_set_ctx('point_0', c.data1, c.data2, c.data3, c.data4 );
|
||||
|
||||
update test t set t.data1 = 100001 where current of c;
|
||||
@ -111,7 +106,7 @@ test_script_1 = """
|
||||
select mon$variable_name as ctx_name, mon$variable_value ctx_value from mon$context_variables where mon$attachment_id = current_connection;
|
||||
"""
|
||||
|
||||
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
|
||||
act_1 = isql_act('db', test_script_1, substitutions=substitutions)
|
||||
|
||||
expected_stdout_1 = """
|
||||
ID 1
|
||||
@ -131,6 +126,7 @@ expected_stdout_1 = """
|
||||
CTX_NAME point_4
|
||||
CTX_VALUE #null# #null# #null# #null#
|
||||
"""
|
||||
|
||||
expected_stderr_1 = """
|
||||
Statement failed, SQLSTATE = 22000
|
||||
no current record for fetch operation
|
||||
@ -141,19 +137,11 @@ expected_stderr_1 = """
|
||||
def test_1(act_1: Action):
|
||||
act_1.expected_stdout = expected_stdout_1
|
||||
act_1.expected_stderr = expected_stderr_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
|
||||
assert (act_1.clean_stderr == act_1.clean_expected_stderr and
|
||||
act_1.clean_stdout == act_1.clean_expected_stdout)
|
||||
|
||||
# version: 4.0
|
||||
# resources: None
|
||||
|
||||
substitutions_2 = [('[ \t]+', ' '), ('line: [\\d]+[,]{0,1} col: [\\d]+', '')]
|
||||
|
||||
init_script_2 = """"""
|
||||
|
||||
db_2 = db_factory(sql_dialect=3, init=init_script_2)
|
||||
|
||||
test_script_2 = """
|
||||
-- see also:
|
||||
@ -169,13 +157,13 @@ test_script_2 = """
|
||||
create or alter procedure sp_set_ctx(a_point varchar(20), a_data1 int, a_data2 int, a_data3 int, a_data4 int) as
|
||||
begin
|
||||
-- Store values of cursor fields in the context variable which name is passed here as 'a_point'.
|
||||
rdb$set_context(
|
||||
'USER_SESSION',
|
||||
rdb$set_context(
|
||||
'USER_SESSION',
|
||||
a_point,
|
||||
coalesce(cast( a_data1 as char(6)),'#null#')
|
||||
coalesce(cast( a_data1 as char(6)),'#null#')
|
||||
|| ' ' || coalesce(cast( a_data2 as char(6)),'#null#')
|
||||
|| ' ' || coalesce(cast( a_data3 as char(6)),'#null#')
|
||||
|| ' ' || coalesce(cast( a_data4 as char(6)),'#null#')
|
||||
|| ' ' || coalesce(cast( a_data4 as char(6)),'#null#')
|
||||
);
|
||||
end
|
||||
^
|
||||
@ -188,10 +176,10 @@ test_script_2 = """
|
||||
-- Do _NOT_ try to check following statements using explicit cursor
|
||||
-- (i.e. OPEN <C>; FETCH ...; CLOSE <C>)
|
||||
for
|
||||
select t.id, t.data1, t.data2, t.data3, t.data4 from test t where t.id = 1
|
||||
select t.id, t.data1, t.data2, t.data3, t.data4 from test t where t.id = 1
|
||||
as cursor c
|
||||
do begin
|
||||
|
||||
|
||||
execute procedure sp_set_ctx('point_0', c.data1, c.data2, c.data3, c.data4 );
|
||||
|
||||
update test t set t.data1 = 100001 where current of c;
|
||||
@ -241,7 +229,7 @@ test_script_2 = """
|
||||
select mon$variable_name as ctx_name, mon$variable_value ctx_value from mon$context_variables where mon$attachment_id = current_connection;
|
||||
"""
|
||||
|
||||
act_2 = isql_act('db_2', test_script_2, substitutions=substitutions_2)
|
||||
act_2 = isql_act('db', test_script_2, substitutions=substitutions)
|
||||
|
||||
expected_stdout_2 = """
|
||||
CTX_NAME point_0
|
||||
|
@ -1,28 +1,23 @@
|
||||
#coding:utf-8
|
||||
#
|
||||
# id: bugs.core_3364
|
||||
# title: Blob filter to translate internal debug info into text representation
|
||||
# decription:
|
||||
# tracker_id: CORE-3364
|
||||
# min_versions: ['3.0']
|
||||
# versions: 3.0
|
||||
# qmid: None
|
||||
|
||||
"""
|
||||
ID: issue-3730
|
||||
ISSUE: 3730
|
||||
TITLE: Blob filter to translate internal debug info into text representation
|
||||
DESCRIPTION:
|
||||
JIRA: CORE-3364
|
||||
"""
|
||||
|
||||
import pytest
|
||||
from firebird.qa import db_factory, isql_act, Action
|
||||
from firebird.qa import *
|
||||
|
||||
# version: 3.0
|
||||
# resources: None
|
||||
|
||||
substitutions_1 = [('RDB\\$DEBUG_INFO', ''), ('-', ''), ('[0-9]+[ ]+[0-9]+[ ]+[0-9]+', '')]
|
||||
|
||||
init_script_1 = """
|
||||
init_script = """
|
||||
set term ^;
|
||||
create or alter procedure sp_test(a_n smallint) returns(n_fact bigint) as
|
||||
begin
|
||||
n_fact = iif(a_n > 0, a_n, 0);
|
||||
|
||||
while (a_n > 1) do
|
||||
|
||||
while (a_n > 1) do
|
||||
begin
|
||||
n_fact = n_fact * (a_n - 1);
|
||||
a_n = a_n -1;
|
||||
@ -34,17 +29,18 @@ init_script_1 = """
|
||||
commit;
|
||||
"""
|
||||
|
||||
db_1 = db_factory(page_size=4096, sql_dialect=3, init=init_script_1)
|
||||
db = db_factory(page_size=4096, sql_dialect=3, init=init_script)
|
||||
|
||||
test_script_1 = """
|
||||
test_script = """
|
||||
set list on;
|
||||
set blob all;
|
||||
select rdb$debug_info from rdb$procedures where upper(rdb$procedure_name) = upper('sp_test');
|
||||
"""
|
||||
|
||||
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
|
||||
act = isql_act('db', test_script, substitutions=[('RDB\\$DEBUG_INFO', ''), ('-', ''),
|
||||
('[0-9]+[ ]+[0-9]+[ ]+[0-9]+', '')])
|
||||
|
||||
expected_stdout_1 = """
|
||||
expected_stdout = """
|
||||
RDB$DEBUG_INFO 1a:f0
|
||||
Parameters:
|
||||
Number Name Type
|
||||
@ -68,8 +64,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,54 +1,22 @@
|
||||
#coding:utf-8
|
||||
#
|
||||
# id: bugs.core_3365
|
||||
# title: Extend syntax for ALTER USER CURRENT_USER
|
||||
# decription:
|
||||
# Replaced old code: removed EDS from here as it is not needed at all:
|
||||
# we can use here trivial "connect '$(DSN)' ..." instead.
|
||||
# Non-privileged user is created in this test and then we check that
|
||||
# he is able to change his personal data: password, firstname and any of
|
||||
# TAGS key-value pair (avaliable in Srp only).
|
||||
#
|
||||
# Checked on 4.0.0.1635: OK, 3.773s; 3.0.5.33180: OK, 2.898s.
|
||||
#
|
||||
# tracker_id: CORE-3365
|
||||
# min_versions: ['3.0']
|
||||
# versions: 3.0
|
||||
# qmid: None
|
||||
|
||||
"""
|
||||
ID: issue-3731
|
||||
ISSUE: 3731
|
||||
TITLE: Extend syntax for ALTER USER CURRENT_USER
|
||||
DESCRIPTION:
|
||||
JIRA: CORE-3365
|
||||
"""
|
||||
|
||||
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 = [('[ \t]+', ' '), ('=', '')]
|
||||
|
||||
init_script_1 = """"""
|
||||
|
||||
db_1 = db_factory(sql_dialect=3, init=init_script_1)
|
||||
|
||||
test_script_1 = """
|
||||
test_script = """
|
||||
set bail on;
|
||||
set count on;
|
||||
|
||||
-- Drop any old account with name = 'TMP$C3365' if it remains from prevoius run:
|
||||
set term ^;
|
||||
execute block as
|
||||
begin
|
||||
begin
|
||||
execute statement 'drop user tmp$c3365 using plugin Srp' with autonomous transaction;
|
||||
when any do begin end
|
||||
end
|
||||
|
||||
begin
|
||||
execute statement 'drop user tmp$c3365 using plugin Legacy_UserManager' with autonomous transaction;
|
||||
when any do begin end
|
||||
end
|
||||
end^
|
||||
set term ;^
|
||||
commit;
|
||||
|
||||
set width usrname 10;
|
||||
set width firstname 10;
|
||||
set width sec_plugin 20;
|
||||
@ -63,7 +31,7 @@ test_script_1 = """
|
||||
,su.sec$plugin as sec_plugin
|
||||
,sa.sec$key as sec_attr_key
|
||||
,sa.sec$value as sec_attr_val
|
||||
from sec$users su left
|
||||
from sec$users su left
|
||||
join sec$user_attributes sa using(sec$user_name, sec$plugin)
|
||||
where su.sec$user_name = upper('tmp$c3365');
|
||||
commit;
|
||||
@ -79,10 +47,10 @@ test_script_1 = """
|
||||
|
||||
select 'before altering' as msg, v.* from v_usr_info v;
|
||||
commit;
|
||||
|
||||
|
||||
connect '$(DSN)' user tmp$c3365 password 'Ir0nM@n';
|
||||
|
||||
alter current user
|
||||
alter current user
|
||||
set password 'H1ghWaySt@r' firstname 'Ian'
|
||||
using plugin Srp
|
||||
tags (initname='Ian', surname='Gillan', groupname='Deep Purple', drop birthday)
|
||||
@ -94,15 +62,13 @@ test_script_1 = """
|
||||
|
||||
select 'after altering' as msg, v.* from v_usr_info v;
|
||||
commit;
|
||||
|
||||
connect '$(DSN)' user SYSDBA password 'masterkey';
|
||||
drop user tmp$c3365 using plugin Srp;
|
||||
commit;
|
||||
"""
|
||||
|
||||
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
|
||||
act = isql_act('db', test_script, substitutions=[('[ \t]+', ' '), ('=', '')])
|
||||
|
||||
expected_stdout_1 = """
|
||||
test_user = user_factory('db', name='tmp$c3365', do_not_create=True)
|
||||
|
||||
expected_stdout = """
|
||||
MSG USRNAME FIRSTNAME SEC_PLUGIN SEC_ATTR_KEY SEC_ATTR_VAL
|
||||
=============== ========== ========== ==================== ==================== ====================
|
||||
before altering TMP$C3365 John Srp BIRTHDAY 03.12.1948
|
||||
@ -120,8 +86,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, test_user):
|
||||
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_3373
|
||||
# title: It is possible to store string with lenght 31 chars into column varchar(25)
|
||||
# decription:
|
||||
# tracker_id: CORE-3373
|
||||
# min_versions: ['3.0']
|
||||
# versions: 3.0
|
||||
# qmid: None
|
||||
|
||||
"""
|
||||
ID: issue-3739
|
||||
ISSUE: 3739
|
||||
TITLE: It is possible to store string with lenght 31 chars into column varchar(25)
|
||||
DESCRIPTION:
|
||||
JIRA: CORE-3373
|
||||
"""
|
||||
|
||||
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 = """
|
||||
recreate table t1(c varchar(25));
|
||||
recreate table t2(c varchar(25));
|
||||
commit;
|
||||
@ -25,7 +20,7 @@ init_script_1 = """
|
||||
execute block as
|
||||
begin
|
||||
execute statement 'drop domain dm_vc25';
|
||||
when any do
|
||||
when any do
|
||||
begin end
|
||||
end
|
||||
^
|
||||
@ -38,24 +33,25 @@ init_script_1 = """
|
||||
commit;
|
||||
"""
|
||||
|
||||
db_1 = db_factory(sql_dialect=3, init=init_script_1)
|
||||
db = db_factory(sql_dialect=3, init=init_script)
|
||||
|
||||
test_script_1 = """
|
||||
test_script = """
|
||||
set count on;
|
||||
set echo on;
|
||||
insert into t1(c) values ('1234567890123456789012345xxxxxx');
|
||||
insert into t2(c) values ('1234567890123456789012345xxxxxx');
|
||||
"""
|
||||
|
||||
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
|
||||
act = isql_act('db', test_script)
|
||||
|
||||
expected_stdout_1 = """
|
||||
expected_stdout = """
|
||||
insert into t1(c) values ('1234567890123456789012345xxxxxx');
|
||||
Records affected: 0
|
||||
insert into t2(c) values ('1234567890123456789012345xxxxxx');
|
||||
Records affected: 0
|
||||
"""
|
||||
expected_stderr_1 = """
|
||||
|
||||
expected_stderr = """
|
||||
Statement failed, SQLSTATE = 22001
|
||||
arithmetic exception, numeric overflow, or string truncation
|
||||
-string right truncation
|
||||
@ -67,10 +63,10 @@ expected_stderr_1 = """
|
||||
"""
|
||||
|
||||
@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_stderr == act_1.clean_expected_stderr
|
||||
assert act_1.clean_stdout == act_1.clean_expected_stdout
|
||||
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,43 +1,36 @@
|
||||
#coding:utf-8
|
||||
#
|
||||
# id: bugs.core_3374
|
||||
# title: Server may crash or corrupt data if SELECT WITH LOCK is issued against records not in the latest format
|
||||
# decription: Actually there is NO crash in 2.5.0, checked SS/SC/CS, WI-V2.5.0.26074.
|
||||
# tracker_id: CORE-3374
|
||||
# min_versions: ['2.5.1']
|
||||
# versions: 2.5.1
|
||||
# qmid: None
|
||||
|
||||
"""
|
||||
ID: issue-3740
|
||||
ISSUE: 3740
|
||||
TITLE: Server may crash or corrupt data if SELECT WITH LOCK is issued against records not in the latest format
|
||||
DESCRIPTION:
|
||||
JIRA: CORE-3374
|
||||
"""
|
||||
|
||||
import pytest
|
||||
from firebird.qa import db_factory, isql_act, Action
|
||||
from firebird.qa import *
|
||||
|
||||
# version: 2.5.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 = """
|
||||
create table test (col1 int, col2 varchar(10), col3 date);
|
||||
insert into test values (1, 'qwerty', date '01.01.2015');
|
||||
alter table test drop col2;
|
||||
set list on;
|
||||
select * from test order by col1 with lock; -- crash here
|
||||
select * from test order by col1 with lock; -- crash here
|
||||
"""
|
||||
|
||||
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
|
||||
act = isql_act('db', test_script)
|
||||
|
||||
expected_stdout_1 = """
|
||||
expected_stdout = """
|
||||
COL1 1
|
||||
COL3 2015-01-01
|
||||
"""
|
||||
|
||||
@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,26 +1,19 @@
|
||||
#coding:utf-8
|
||||
#
|
||||
# id: bugs.core_3394
|
||||
# title: Failed attempt to violate unique constraint could leave unneeded "lock conflict" error in status-vector
|
||||
# decription:
|
||||
# tracker_id: CORE-3394
|
||||
# min_versions: ['2.5.1']
|
||||
# versions: 2.5.1
|
||||
# qmid: None
|
||||
|
||||
"""
|
||||
ID: issue-3760
|
||||
ISSUE: 3760
|
||||
TITLE: Failed attempt to violate unique constraint could leave unneeded "lock conflict" error in status-vector
|
||||
DESCRIPTION:
|
||||
JIRA: CORE-3394
|
||||
"""
|
||||
|
||||
import pytest
|
||||
from firebird.qa import db_factory, isql_act, Action
|
||||
from firebird.qa import *
|
||||
|
||||
# version: 2.5.1
|
||||
# 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 = """
|
||||
recreate table t(id int, constraint t_pk primary key(id) using index t_id);
|
||||
commit;
|
||||
SET TRANSACTION READ COMMITTED RECORD_VERSION NO WAIT;
|
||||
@ -36,18 +29,18 @@ test_script_1 = """
|
||||
rollback;
|
||||
"""
|
||||
|
||||
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 = 23000
|
||||
violation of PRIMARY or UNIQUE KEY constraint "T_PK" on table "T"
|
||||
-Problematic key value is ("ID" = 1)
|
||||
-At block line: 5, col: 7
|
||||
"""
|
||||
|
||||
@pytest.mark.version('>=2.5.1')
|
||||
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,34 +0,0 @@
|
||||
#coding:utf-8
|
||||
#
|
||||
# id: bugs.core_3398
|
||||
# title: GRANT ADMIN ROLE not accepted
|
||||
# decription:
|
||||
# tracker_id: CORE-3398
|
||||
# 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 = """
|
||||
-- See ticket issue: Alexander Peshkov added a comment - 21/Mar/11 03:10 PM
|
||||
-- Does not require frontporting - FB3 is using another way to access security database
|
||||
"""
|
||||
|
||||
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
|
||||
|
||||
|
||||
@pytest.mark.version('>=3.0')
|
||||
def test_1(act_1: Action):
|
||||
act_1.execute()
|
||||
|
@ -1,26 +1,19 @@
|
||||
#coding:utf-8
|
||||
#
|
||||
# id: bugs.core_3399
|
||||
# title: Allow write operations to temporary tables in read only transactions
|
||||
# decription:
|
||||
# tracker_id: CORE-3399
|
||||
# min_versions: ['2.5.1']
|
||||
# versions: 2.5.1
|
||||
# qmid: None
|
||||
|
||||
"""
|
||||
ID: issue-3765
|
||||
ISSUE: 3765
|
||||
TITLE: Allow write operations to temporary tables in read only transactions
|
||||
DESCRIPTION:
|
||||
JIRA: CORE-3399
|
||||
"""
|
||||
|
||||
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='core3399-read_only.fbk', async_write=False)
|
||||
|
||||
substitutions_1 = [('=.*', '')]
|
||||
|
||||
init_script_1 = """"""
|
||||
|
||||
db_1 = db_factory(from_backup='core3399-read_only.fbk', init=init_script_1, async_write=False)
|
||||
|
||||
test_script_1 = """
|
||||
test_script = """
|
||||
-- ======= from the ticket: ========
|
||||
-- Implementation allows:
|
||||
-- 1) writes into all kind of GTT's in read only transactions in read write database
|
||||
@ -36,17 +29,17 @@ test_script_1 = """
|
||||
select * from gtt_del_rows;
|
||||
"""
|
||||
|
||||
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
|
||||
=======
|
||||
1
|
||||
"""
|
||||
|
||||
@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,26 +1,19 @@
|
||||
#coding:utf-8
|
||||
#
|
||||
# id: bugs.core_3401
|
||||
# title: Collation errors with [type of] <domain>, type of column
|
||||
# decription:
|
||||
# tracker_id: CORE-3401
|
||||
# min_versions: ['3.0']
|
||||
# versions: 3.0
|
||||
# qmid:
|
||||
|
||||
"""
|
||||
ID: issue-3766
|
||||
ISSUE: 3766
|
||||
TITLE: Collation errors with [type of] <domain>, type of column
|
||||
DESCRIPTION:
|
||||
JIRA: CORE-3401
|
||||
"""
|
||||
|
||||
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 = """
|
||||
-----------------------------------------------------------------------------------------------
|
||||
-- NB-1. Initial test (which is in the tracker) considered only ASCII characters 'a' vs 'A'.
|
||||
-- This test compares many NON-ascii characters with diacritical marks - it was done intentionally.
|
||||
@ -157,9 +150,9 @@ test_script_1 = """
|
||||
) p;
|
||||
"""
|
||||
|
||||
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
|
||||
act = isql_act('db', test_script)
|
||||
|
||||
expected_stdout_1 = """
|
||||
expected_stdout = """
|
||||
MSG case-1
|
||||
EQUAL 1
|
||||
MSG case-2
|
||||
@ -171,8 +164,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(charset='utf8')
|
||||
assert act_1.clean_stdout == act_1.clean_expected_stdout
|
||||
def test_1(act: Action):
|
||||
act.expected_stdout = expected_stdout
|
||||
act.execute(charset='utf8')
|
||||
assert act.clean_stdout == act.clean_expected_stdout
|
||||
|
||||
|
@ -1,208 +1,38 @@
|
||||
#coding:utf-8
|
||||
#
|
||||
# id: bugs.core_3413
|
||||
# title: Improve diagnostics of internal trace errors
|
||||
# decription:
|
||||
# 1. Obtain engine_version from built-in context variable.
|
||||
# 2. Make config for trace in proper format according to FB engine version,
|
||||
# with adding invalid element 'foo' instead on boolean ('true' or 'false')
|
||||
# 3. Launch trace session in separate child process using 'FBSVCMGR action_trace_start'
|
||||
# 4. Run ISQL with trivial command in order trace session will register error in its log.
|
||||
# 5. Stop trace session. Output its log with filtering only messages related to error.
|
||||
#
|
||||
# Checked on: WI-V2.5.5.26916 (SS, SC, CS); WI-V3.0.0.32008 (SS, SC, CS). Result: OK.
|
||||
# ::: NB :::
|
||||
# Several delays (time.sleep) added in main thread because of OS buffering. Couldn't switch this buffering off.
|
||||
#
|
||||
# tracker_id: CORE-3413
|
||||
# min_versions: ['2.5.1']
|
||||
# versions: 2.5.1
|
||||
# qmid: None
|
||||
|
||||
"""
|
||||
ID: issue-3776
|
||||
ISSUE: 3776
|
||||
TITLE: Improve diagnostics of internal trace errors
|
||||
DESCRIPTION:
|
||||
JIRA: CORE-3413
|
||||
"""
|
||||
|
||||
import pytest
|
||||
from firebird.qa import db_factory, python_act, Action
|
||||
from firebird.qa import *
|
||||
|
||||
# version: 2.5.1
|
||||
# resources: None
|
||||
substitutions = [('^((?!ERROR|ELEMENT).)*$', ''),
|
||||
('ERROR CREATING TRACE SESSION.*', 'ERROR CREATING TRACE SESSION'),
|
||||
('.*"FOO" IS NOT A VALID.*', '"FOO" IS NOT A VALID')]
|
||||
|
||||
substitutions_1 = [('^((?!ERROR|ELEMENT).)*$', ''),
|
||||
('ERROR CREATING TRACE SESSION.*', 'ERROR CREATING TRACE SESSION'),
|
||||
('.*"FOO" IS NOT A VALID.*', '"FOO" IS NOT A VALID')]
|
||||
db = db_factory()
|
||||
|
||||
init_script_1 = """"""
|
||||
act = python_act('db', substitutions=substitutions)
|
||||
|
||||
db_1 = db_factory(sql_dialect=3, init=init_script_1)
|
||||
|
||||
# test_script_1
|
||||
#---
|
||||
# import os
|
||||
# import subprocess
|
||||
# from subprocess import Popen
|
||||
# import time
|
||||
#
|
||||
# os.environ["ISC_USER"] = user_name
|
||||
# os.environ["ISC_PASSWORD"] = user_password
|
||||
#
|
||||
# db_file=db_conn.database_name
|
||||
#
|
||||
# # Obtain engine version, 2.5 or 3.0, for make trace config in appropriate format:
|
||||
# engine = str(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'):
|
||||
# # 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] )
|
||||
# if os.path.isfile( f_names_list[i]):
|
||||
# print('ERROR: can not remove file ' + f_names_list[i])
|
||||
#
|
||||
# #--------------------------------------------
|
||||
#
|
||||
#
|
||||
# txt25 = '''# Trace config, format for 2.5. Generated auto, do not edit!
|
||||
# <database %[\\\\\\\\/]bugs.core_3413.fdb>
|
||||
# enabled true
|
||||
# time_threshold 0
|
||||
#
|
||||
# # Value for this parameter was intentionally choosen *** INVALID ***
|
||||
# log_statement_finish foo
|
||||
# </database>
|
||||
# '''
|
||||
#
|
||||
# # NOTES ABOUT TRACE CONFIG FOR 3.0:
|
||||
# # 1) Header contains `database` clause in different format vs FB 2.5: its data must be enclosed with '{' '}'
|
||||
# # 2) Name and value must be separated by EQUALITY sign ('=') in FB-3 trace.conf, otherwise we get runtime error:
|
||||
# # element "<. . .>" have no attribute value set
|
||||
#
|
||||
# txt30 = '''# Trace config, format for 3.0. Generated auto, do not edit!
|
||||
# database=%[\\\\\\\\/]bugs.core_3413.fdb
|
||||
# {
|
||||
# enabled = true
|
||||
# time_threshold = 0
|
||||
#
|
||||
# # Value for this parameter was intentionally choosen *** INVALID ***
|
||||
# log_statement_finish = foo
|
||||
# }
|
||||
# '''
|
||||
#
|
||||
# f_trccfg=open( os.path.join(context['temp_directory'],'tmp_trace_3413.cfg'), 'w')
|
||||
# if engine.startswith('2.5'):
|
||||
# f_trccfg.write(txt25)
|
||||
# else:
|
||||
# f_trccfg.write(txt30)
|
||||
# flush_and_close( f_trccfg )
|
||||
#
|
||||
# #####################################################
|
||||
# # Starting trace session in new child process (async.):
|
||||
#
|
||||
# f_trclog=open( os.path.join(context['temp_directory'],'tmp_trace_3413.log'), 'w')
|
||||
#
|
||||
# # Execute a child program in a new process, redirecting STDERR to the same target as of STDOUT:
|
||||
# p_trace=Popen([context['fbsvcmgr_path'], "localhost:service_mgr",
|
||||
# "action_trace_start",
|
||||
# "trc_cfg", f_trccfg.name],
|
||||
# stdout=f_trclog, stderr=subprocess.STDOUT)
|
||||
#
|
||||
# # Wait! Trace session is initialized not instantly!
|
||||
# time.sleep(1)
|
||||
#
|
||||
# sqltxt='''
|
||||
# set list on;
|
||||
# select 1 as c from rdb$database;
|
||||
# '''
|
||||
#
|
||||
# runProgram('isql',[dsn,'-user',user_name,'-pas',user_password],sqltxt)
|
||||
#
|
||||
# # do NOT remove this otherwise trace log can contain only message about its start before being closed!
|
||||
# time.sleep(3)
|
||||
#
|
||||
# #####################################################
|
||||
# # Getting ID of launched trace session and STOP it:
|
||||
#
|
||||
# # Save active trace session info into file for further parsing it and obtain session_id back (for stop):
|
||||
# f_trclst=open( os.path.join(context['temp_directory'],'tmp_trace_3413.lst'), 'w')
|
||||
# subprocess.call([context['fbsvcmgr_path'], "localhost:service_mgr",
|
||||
# "action_trace_list"],
|
||||
# stdout=f_trclst, stderr=subprocess.STDOUT
|
||||
# )
|
||||
# flush_and_close( f_trclst )
|
||||
#
|
||||
# trcssn=0
|
||||
# with open( f_trclst.name,'r') as f:
|
||||
# for line in f:
|
||||
# i=1
|
||||
# if 'Session ID' in line:
|
||||
# for word in line.split():
|
||||
# if i==3:
|
||||
# trcssn=word
|
||||
# i=i+1
|
||||
# break
|
||||
#
|
||||
# # Result: `trcssn` is ID of active trace session. Now we have to terminate it:
|
||||
# f_trclst=open(f_trclst.name,'a')
|
||||
# f_trclst.seek(0,2)
|
||||
# subprocess.call([context['fbsvcmgr_path'], "localhost:service_mgr",
|
||||
# "action_trace_stop",
|
||||
# "trc_id",trcssn],
|
||||
# stdout=f_trclst, stderr=subprocess.STDOUT
|
||||
# )
|
||||
# flush_and_close( f_trclst )
|
||||
#
|
||||
# # Terminate child process of launched trace session (though it should already be killed):
|
||||
# p_trace.terminate()
|
||||
# flush_and_close( f_trclog )
|
||||
#
|
||||
# with open( f_trclog.name,'r') as f:
|
||||
# for line in f:
|
||||
# print(line.upper())
|
||||
#
|
||||
# # do NOT remove this delay otherwise get access error 'Windows 32'
|
||||
# # (The process cannot access the file because it is being used by another process):
|
||||
# time.sleep(1)
|
||||
#
|
||||
# # Cleanup
|
||||
# #############
|
||||
# cleanup( [i.name for i in (f_trccfg, f_trclst, f_trclog)] )
|
||||
#
|
||||
#
|
||||
#---
|
||||
|
||||
act_1 = python_act('db_1', substitutions=substitutions_1)
|
||||
|
||||
expected_stdout_1 = """
|
||||
expected_stdout = """
|
||||
ERROR CREATING TRACE SESSION FOR DATABASE
|
||||
ERROR WHILE PARSING TRACE CONFIGURATION
|
||||
ELEMENT "LOG_STATEMENT_FINISH": "FOO" IS NOT A VALID
|
||||
"""
|
||||
|
||||
trace_1 = ['time_threshold = 0',
|
||||
trace = ['time_threshold = 0',
|
||||
'log_statement_finish = foo'
|
||||
]
|
||||
|
||||
@pytest.mark.version('>=3.0')
|
||||
def test_1(act_1: Action):
|
||||
with act_1.trace(db_events=trace_1):
|
||||
act_1.isql(switches=['-n'], input='select 1 as c from rdb$database;')
|
||||
act_1.expected_stdout = expected_stdout_1
|
||||
act_1.trace_to_stdout(upper=True)
|
||||
assert act_1.clean_stdout == act_1.clean_expected_stdout
|
||||
def test_1(act: Action):
|
||||
with act.trace(db_events=trace):
|
||||
act.isql(switches=['-n'], input='select 1 as c from rdb$database;')
|
||||
act.expected_stdout = expected_stdout
|
||||
act.trace_to_stdout(upper=True)
|
||||
assert act.clean_stdout == act.clean_expected_stdout
|
||||
|
@ -1,124 +1,28 @@
|
||||
#coding:utf-8
|
||||
#
|
||||
# id: bugs.core_3416
|
||||
# title: Inserting Käse into a CHARACTER SET ASCII column succeeds
|
||||
# decription:
|
||||
# 02-mar-2021. Re-implemented in order to have ability to run this test on Linux.
|
||||
# Test creates table and fills it with non-ascii characters in init_script, using charset = UTF8.
|
||||
# Then it generates .sql script for running it in separae ISQL process.
|
||||
# This script makes connection to test DB using charset = WIN1252 and perform needed DML.
|
||||
# Result will be redirected to .log which will be opened via codecs.open(...encoding='cp1252').
|
||||
# Its content will be converted to UTF8 for showing in expected_stdout.
|
||||
#
|
||||
# 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-3416
|
||||
# min_versions: ['2.5.0']
|
||||
# versions: 2.5
|
||||
# qmid:
|
||||
|
||||
"""
|
||||
ID: issue-3779
|
||||
ISSUE: 3779
|
||||
TITLE: Inserting Käse into a CHARACTER SET ASCII column succeeds
|
||||
DESCRIPTION:
|
||||
JIRA: CORE-3416
|
||||
"""
|
||||
|
||||
import pytest
|
||||
from pathlib import Path
|
||||
from firebird.qa import db_factory, python_act, Action, temp_file
|
||||
from firebird.qa import *
|
||||
|
||||
# version: 2.5
|
||||
# resources: None
|
||||
|
||||
substitutions_1 = [('After line .*', ''), ('[\t ]+', ' ')]
|
||||
|
||||
init_script_1 = """
|
||||
init_script = """
|
||||
create table tascii(s_ascii varchar(10) character set ascii);
|
||||
create table tlatin(s_latin varchar(10) character set latin1);
|
||||
commit;
|
||||
"""
|
||||
|
||||
db_1 = db_factory(sql_dialect=3, init=init_script_1)
|
||||
db = db_factory(init=init_script)
|
||||
|
||||
# test_script_1
|
||||
#---
|
||||
#
|
||||
# import os
|
||||
# import codecs
|
||||
# import subprocess
|
||||
# import time
|
||||
#
|
||||
# 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 names WIN1252;
|
||||
# connect '%(dsn)s' user '%(user_name)s' password '%(user_password)s';
|
||||
# set list on;
|
||||
# set count on;
|
||||
# set echo on;
|
||||
# insert into tascii values ('Käse');
|
||||
# select s_ascii from tascii;
|
||||
#
|
||||
# insert into tlatin values ('Käse');
|
||||
# select s_latin from tlatin;
|
||||
# ''' % dict(globals(), **locals())
|
||||
#
|
||||
# f_run_sql = open( os.path.join(context['temp_directory'], 'tmp_3416_win1252.sql'), 'w' )
|
||||
# f_run_sql.write( sql_txt.decode('utf8').encode('cp1252') )
|
||||
# flush_and_close( f_run_sql )
|
||||
# # result: file tmp_3416_win1252.sql is encoded in win1252
|
||||
#
|
||||
# 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 win1252
|
||||
#
|
||||
# with codecs.open(f_run_log.name, 'r', encoding='cp1252' ) as f:
|
||||
# result_in_cp1252 = f.readlines()
|
||||
#
|
||||
# for i in result_in_cp1252:
|
||||
# print( i.encode('utf8') )
|
||||
#
|
||||
# # cleanup:
|
||||
# ###########
|
||||
# cleanup( (f_run_sql, f_run_log) )
|
||||
#
|
||||
#
|
||||
#---
|
||||
act = python_act('db', substitutions=[('After line .*', ''), ('[\t ]+', ' ')])
|
||||
|
||||
act_1 = python_act('db_1', substitutions=substitutions_1)
|
||||
|
||||
expected_stdout_1 = """
|
||||
expected_stdout = """
|
||||
insert into tascii values ('Käse');
|
||||
|
||||
Records affected: 0
|
||||
@ -134,18 +38,18 @@ expected_stdout_1 = """
|
||||
Records affected: 1
|
||||
"""
|
||||
|
||||
expected_stderr_1 = """
|
||||
expected_stderr = """
|
||||
Statement failed, SQLSTATE = 22018
|
||||
arithmetic exception, numeric overflow, or string truncation
|
||||
-Cannot transliterate character between character sets
|
||||
After line 4 in file /tmp/pytest-of-pcisar/pytest-559/test_10/test_script.sql
|
||||
"""
|
||||
|
||||
test_script_1 = temp_file('test_script.sql')
|
||||
script_file = temp_file('test_script.sql')
|
||||
|
||||
@pytest.mark.version('>=2.5')
|
||||
def test_1(act_1: Action, test_script_1: Path):
|
||||
test_script_1.write_text("""
|
||||
@pytest.mark.version('>=3')
|
||||
def test_1(act: Action, script_file: Path):
|
||||
script_file.write_text("""
|
||||
set list on;
|
||||
set count on;
|
||||
set echo on;
|
||||
@ -154,11 +58,11 @@ def test_1(act_1: Action, test_script_1: Path):
|
||||
insert into tlatin values ('Käse');
|
||||
select s_latin from tlatin;
|
||||
""", encoding='cp1252')
|
||||
act_1.expected_stdout = expected_stdout_1
|
||||
act_1.expected_stderr = expected_stderr_1
|
||||
act_1.isql(switches=[], input_file=test_script_1, charset='WIN1252')
|
||||
assert act_1.clean_stderr == act_1.clean_expected_stderr
|
||||
assert act_1.clean_stdout == act_1.clean_expected_stdout
|
||||
act.expected_stdout = expected_stdout
|
||||
act.expected_stderr = expected_stderr
|
||||
act.isql(switches=[], input_file=script_file, charset='WIN1252')
|
||||
assert (act.clean_stderr == act.clean_expected_stderr and
|
||||
act.clean_stdout == act.clean_expected_stdout)
|
||||
|
||||
|
||||
|
||||
|
@ -1,22 +1,17 @@
|
||||
#coding:utf-8
|
||||
#
|
||||
# id: bugs.core_3418
|
||||
# title: Database trigger created as INACTIVE is active
|
||||
# decription:
|
||||
# tracker_id: CORE-3418
|
||||
# min_versions: ['2.1.5']
|
||||
# versions: 2.1.5
|
||||
# qmid: None
|
||||
|
||||
"""
|
||||
ID: issue-3781
|
||||
ISSUE: 3781
|
||||
TITLE: Database trigger created as INACTIVE is active
|
||||
DESCRIPTION:
|
||||
JIRA: CORE-3418
|
||||
"""
|
||||
|
||||
import pytest
|
||||
from firebird.qa import db_factory, isql_act, Action
|
||||
from firebird.qa import *
|
||||
|
||||
# version: 2.1.5
|
||||
# resources: None
|
||||
|
||||
substitutions_1 = [('[ \t]+', ' ')]
|
||||
|
||||
init_script_1 = """
|
||||
init_script = """
|
||||
set term ^ ;
|
||||
create or alter trigger trg$start inactive on transaction start position 0 as
|
||||
begin
|
||||
@ -27,22 +22,22 @@ 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;
|
||||
select rdb$get_context('USER_SESSION', 'TRANS_ID') as ctx_var 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 = """
|
||||
CTX_VAR <null>
|
||||
expected_stdout = """
|
||||
CTX_VAR <null>
|
||||
"""
|
||||
|
||||
@pytest.mark.version('>=2.1.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_3419
|
||||
# title: Recurse leads to hangs/crash server
|
||||
# decription:
|
||||
# tracker_id: CORE-3419
|
||||
# min_versions: ['2.5.1']
|
||||
# versions: 2.5.1
|
||||
# qmid: None
|
||||
|
||||
"""
|
||||
ID: issue-3782
|
||||
ISSUE: 3782
|
||||
TITLE: Recurse leads to hangs/crash server
|
||||
DESCRIPTION:
|
||||
JIRA: CORE-3419
|
||||
"""
|
||||
|
||||
import pytest
|
||||
from firebird.qa import db_factory, isql_act, Action
|
||||
from firebird.qa import *
|
||||
|
||||
# version: 2.5.1
|
||||
# resources: None
|
||||
db = db_factory()
|
||||
|
||||
substitutions_1 = [('line: [0-9]+, col: [0-9]+', 'line: , col: ')]
|
||||
|
||||
init_script_1 = """"""
|
||||
|
||||
db_1 = db_factory(page_size=4096, sql_dialect=3, init=init_script_1)
|
||||
|
||||
test_script_1 = """
|
||||
test_script = """
|
||||
set autoddl off;
|
||||
commit;
|
||||
recreate table test(id int);
|
||||
@ -40,9 +33,9 @@ test_script_1 = """
|
||||
set transaction;
|
||||
"""
|
||||
|
||||
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
|
||||
act = isql_act('db', test_script, substitutions=[('line: [0-9]+, col: [0-9]+', 'line: , col: ')])
|
||||
|
||||
expected_stderr_1 = """
|
||||
expected_stderr = """
|
||||
Statement failed, SQLSTATE = 54001
|
||||
Too many concurrent executions of the same request
|
||||
-At trigger 'TRG_TRANS_START' line: 5, col: 9
|
||||
@ -70,9 +63,9 @@ expected_stderr_1 = """
|
||||
At trigger 'TRG_TRANS_START' ...
|
||||
"""
|
||||
|
||||
@pytest.mark.version('>=2.5.1')
|
||||
def test_1(act_1: Action):
|
||||
act_1.expected_stderr = expected_stderr_1
|
||||
act_1.execute(charset='utf8')
|
||||
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(charset='utf8')
|
||||
assert act.clean_stderr == act.clean_expected_stderr
|
||||
|
||||
|
@ -1,26 +1,19 @@
|
||||
#coding:utf-8
|
||||
#
|
||||
# id: bugs.core_3420
|
||||
# title: BOOLEAN not present in system table RDB$TYPES
|
||||
# decription:
|
||||
# tracker_id: CORE-3420
|
||||
# min_versions: ['3.0']
|
||||
# versions: 3.0
|
||||
# qmid: None
|
||||
|
||||
"""
|
||||
ID: issue-3783
|
||||
ISSUE: 3783
|
||||
TITLE: BOOLEAN not present in system table RDB$TYPES
|
||||
DESCRIPTION:
|
||||
JIRA: CORE-3420
|
||||
"""
|
||||
|
||||
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 = """
|
||||
set list on;
|
||||
select
|
||||
rdb$field_name,
|
||||
@ -32,9 +25,9 @@ test_script_1 = """
|
||||
order by t.rdb$field_name;
|
||||
"""
|
||||
|
||||
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
|
||||
act = isql_act('db', test_script)
|
||||
|
||||
expected_stdout_1 = """
|
||||
expected_stdout = """
|
||||
RDB$FIELD_NAME RDB$FIELD_TYPE
|
||||
RDB$TYPE 23
|
||||
RDB$TYPE_NAME BOOLEAN
|
||||
@ -46,8 +39,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_3421
|
||||
# title: [FB3] AV with "UPDATE OR INSERT"
|
||||
# decription:
|
||||
# tracker_id: CORE-3421
|
||||
# min_versions: ['3.0']
|
||||
# versions: 3.0
|
||||
# qmid: None
|
||||
|
||||
"""
|
||||
ID: issue-3784
|
||||
ISSUE: 3784
|
||||
TITLE: [FB3] AV with "UPDATE OR INSERT"
|
||||
DESCRIPTION:
|
||||
JIRA: CORE-3421
|
||||
"""
|
||||
|
||||
import pytest
|
||||
from firebird.qa import db_factory, isql_act, Action
|
||||
from firebird.qa import *
|
||||
|
||||
# version: 3.0
|
||||
# resources: None
|
||||
|
||||
substitutions_1 = [('^((?!sqltype|DTS_DIFF).)*$', ''), ('[ ]+', ' '), ('[\t]*', ' ')]
|
||||
|
||||
init_script_1 = """
|
||||
init_script = """
|
||||
create or alter procedure sp_test as begin end;
|
||||
commit;
|
||||
recreate table test(
|
||||
@ -24,10 +19,10 @@ init_script_1 = """
|
||||
s01 varchar(512)
|
||||
);
|
||||
commit;
|
||||
|
||||
|
||||
set term ^;
|
||||
create or alter procedure sp_test( a_id type of column test.id, a_s01 type of column test.s01)
|
||||
returns(o_id type of column test.id, o_s01 type of column test.s01)
|
||||
returns(o_id type of column test.id, o_s01 type of column test.s01)
|
||||
as
|
||||
begin
|
||||
execute statement ('update or insert into test(id, s01) values( :x, :y ) returning id, s01')
|
||||
@ -40,28 +35,29 @@ 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 = """
|
||||
set list on;
|
||||
set sqlda_display on;
|
||||
set planonly;
|
||||
set term ^;
|
||||
execute block returns(o_id type of column test.id, o_s01 type of column test.s01)
|
||||
execute block returns(o_id type of column test.id, o_s01 type of column test.s01)
|
||||
as
|
||||
begin
|
||||
execute procedure sp_test(1, rpad('',512,'9876543210mnbvcxzasdfghjklpoiuytrewq')) returning_values o_id, o_s01;
|
||||
suspend;
|
||||
end
|
||||
end
|
||||
^
|
||||
set term ;^
|
||||
execute procedure sp_test(1, rpad('',512,'abcdefghjklmnopqrstuwwxyz012345678'));
|
||||
select * from sp_test(1, rpad('',512,'0123456789abcdefghjklmnopqrstuwwxyz'));
|
||||
"""
|
||||
|
||||
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
|
||||
act = isql_act('db', test_script, substitutions=[('^((?!sqltype|DTS_DIFF).)*$', ''),
|
||||
('[ ]+', ' '), ('[\t]*', ' ')])
|
||||
|
||||
expected_stdout_1 = """
|
||||
expected_stdout = """
|
||||
01: sqltype: 580 INT64 Nullable scale: 0 subtype: 0 len: 8
|
||||
02: sqltype: 448 VARYING Nullable scale: 0 subtype: 0 len: 512 charset: 0 NONE
|
||||
01: sqltype: 580 INT64 Nullable scale: 0 subtype: 0 len: 8
|
||||
@ -71,8 +67,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_3423
|
||||
# title: [FB3] Wrong RDB$PARAMETER_MECHANISM
|
||||
# decription:
|
||||
# tracker_id: CORE-3423
|
||||
# min_versions: ['2.1.7']
|
||||
# versions: 2.1.7
|
||||
# qmid:
|
||||
|
||||
"""
|
||||
ID: issue-3786
|
||||
ISSUE: 3786
|
||||
TITLE: [FB3] Wrong RDB$PARAMETER_MECHANISM
|
||||
DESCRIPTION:
|
||||
JIRA: CORE-3423
|
||||
"""
|
||||
|
||||
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 sp_test(IN_ARG INTEGER) returns (OUT_ARG INTEGER) as
|
||||
begin
|
||||
@ -29,20 +22,20 @@ test_script_1 = """
|
||||
^
|
||||
set term ;^
|
||||
commit;
|
||||
|
||||
|
||||
set list on;
|
||||
-- NB: engine treats nulls and zeroes as the same value, so it is enough to check that
|
||||
-- parameter mechanism is either null or zero only:
|
||||
select
|
||||
select
|
||||
pp.rdb$parameter_name p_name
|
||||
,iif( coalesce(pp.rdb$parameter_mechanism,0) = 0, 'ZERO_OR_NULL', 'BAD_VALUE' ) p_mechanism
|
||||
from rdb$procedure_parameters pp
|
||||
where pp.rdb$procedure_name = upper('SP_TEST');
|
||||
"""
|
||||
|
||||
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
|
||||
act = isql_act('db', test_script)
|
||||
|
||||
expected_stdout_1 = """
|
||||
expected_stdout = """
|
||||
P_NAME IN_ARG
|
||||
P_MECHANISM ZERO_OR_NULL
|
||||
|
||||
@ -50,9 +43,9 @@ expected_stdout_1 = """
|
||||
P_MECHANISM ZERO_OR_NULL
|
||||
"""
|
||||
|
||||
@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_3427
|
||||
# title: Server crashing with UTF8 blobs
|
||||
# decription:
|
||||
# tracker_id: CORE-3427
|
||||
# min_versions: ['2.5.1']
|
||||
# versions: 2.5.1
|
||||
# qmid:
|
||||
|
||||
"""
|
||||
ID: issue-3789
|
||||
ISSUE: 3789
|
||||
TITLE: Server crashing with UTF8 blobs
|
||||
DESCRIPTION:
|
||||
JIRA: CORE-3427
|
||||
"""
|
||||
|
||||
import pytest
|
||||
from firebird.qa import db_factory, isql_act, Action
|
||||
from firebird.qa import *
|
||||
|
||||
# version: 2.5.1
|
||||
# resources: None
|
||||
db = db_factory(charset='UTF8')
|
||||
|
||||
substitutions_1 = []
|
||||
|
||||
init_script_1 = """"""
|
||||
|
||||
db_1 = db_factory(charset='UTF8', sql_dialect=3, init=init_script_1)
|
||||
|
||||
test_script_1 = """
|
||||
test_script = """
|
||||
create table tbl (blob_field blob sub_type text character set utf8 collate unicode_ci_ai);
|
||||
-- See ticket: seems that this crash depended on concrete data, so it was decided to copy these text from ticket:
|
||||
insert into tbl values ('крупнейший европейский журнал о компьютерах. Вышел на рынок компьютерных изданий с уникальной концепцией и предназначен для людей, которые интересуются компьютерами, Интернетом, средствами телекоммуникаций, аудио-, видео- и фототехникой. Каждые две недели читателям предлагаются новости индустрии, тесты оборудования и программ, обучающие курсы и практические советы. Издание интересно как новичкам, так и опытным пользователям.');
|
||||
@ -28,19 +21,19 @@ test_script_1 = """
|
||||
-- Confirmed crash on 2.5.0, fine on 2.5.1 and later (02.04.2015):
|
||||
set list on;
|
||||
select count(*) cnt
|
||||
from tbl
|
||||
where blob_field like '%test%';
|
||||
from tbl
|
||||
where blob_field like '%test%';
|
||||
"""
|
||||
|
||||
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
|
||||
act = isql_act('db', test_script)
|
||||
|
||||
expected_stdout_1 = """
|
||||
CNT 0
|
||||
expected_stdout = """
|
||||
CNT 0
|
||||
"""
|
||||
|
||||
@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,26 +1,19 @@
|
||||
#coding:utf-8
|
||||
#
|
||||
# id: bugs.core_3431
|
||||
# title: ISQL pads UTF-8 data incorrectly
|
||||
# decription:
|
||||
# tracker_id: CORE-3431
|
||||
# min_versions: ['3.0']
|
||||
# versions: 3.0
|
||||
# qmid:
|
||||
|
||||
"""
|
||||
ID: issue-3793
|
||||
ISSUE: 3793
|
||||
TITLE: ISQL pads UTF-8 data incorrectly
|
||||
DESCRIPTION:
|
||||
JIRA: CORE-3431
|
||||
"""
|
||||
|
||||
import pytest
|
||||
from firebird.qa import db_factory, isql_act, Action
|
||||
from firebird.qa import *
|
||||
|
||||
# version: 3.0
|
||||
# resources: None
|
||||
db = db_factory(charset='UTF8')
|
||||
|
||||
substitutions_1 = []
|
||||
|
||||
init_script_1 = """"""
|
||||
|
||||
db_1 = db_factory(charset='UTF8', sql_dialect=3, init=init_script_1)
|
||||
|
||||
test_script_1 = """
|
||||
test_script = """
|
||||
set term ^;
|
||||
create or alter procedure p1 returns (
|
||||
c1 char(5) character set utf8,
|
||||
@ -74,9 +67,9 @@ test_script_1 = """
|
||||
select * from p1;
|
||||
"""
|
||||
|
||||
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 VC1 VC2
|
||||
====== ========== ====== ==========
|
||||
12345 12345 12345 12345
|
||||
@ -88,8 +81,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,35 +1,24 @@
|
||||
#coding:utf-8
|
||||
#
|
||||
# id: bugs.core_3435
|
||||
# title: Lateral derived tables
|
||||
# decription:
|
||||
# Test is based on public database from sql-ex.ru and several example queries from sql-tutorial.ru:
|
||||
# http://www.sql-tutorial.ru/ru/book_cross_apply/page2.html
|
||||
#
|
||||
# Example queries are published here with kind permission of Sergey Moiseenko, 07.04.2020 11:46.
|
||||
# ::: NB :::
|
||||
# This is INITIAL test of LATERAL-JOIN functional. Additional examples will be implemented later.
|
||||
#
|
||||
# Checked on 4.0.0.1865 SS: 1.360s.
|
||||
#
|
||||
# tracker_id: CORE-3435
|
||||
# min_versions: []
|
||||
# versions: 4.0.0
|
||||
# qmid: None
|
||||
|
||||
"""
|
||||
ID: issue-3797
|
||||
ISSUE: 3797
|
||||
TITLE: Lateral derived tables
|
||||
DESCRIPTION:
|
||||
Test is based on public database from sql-ex.ru and several example queries from sql-tutorial.ru:
|
||||
http://www.sql-tutorial.ru/ru/book_cross_apply/page2.html
|
||||
|
||||
Example queries are published here with kind permission of Sergey Moiseenko, 07.04.2020 11:46.
|
||||
This is INITIAL test of LATERAL-JOIN functional. Additional examples will be implemented later.
|
||||
JIRA: CORE-3435
|
||||
"""
|
||||
|
||||
import pytest
|
||||
from firebird.qa import db_factory, isql_act, Action
|
||||
from firebird.qa import *
|
||||
|
||||
# version: 4.0.0
|
||||
# resources: None
|
||||
db = db_factory(from_backup='sql-ex-open-data.fbk')
|
||||
|
||||
substitutions_1 = [('[ \t]+', ' '), ('===.*', '')]
|
||||
|
||||
init_script_1 = """"""
|
||||
|
||||
db_1 = db_factory(from_backup='sql-ex-open-data.fbk', init=init_script_1)
|
||||
|
||||
test_script_1 = """
|
||||
test_script = """
|
||||
set term ^;
|
||||
create or alter function fn_get_next_laptop_model(a_code type of column laptop.code ) returns varchar(50) deterministic as
|
||||
begin
|
||||
@ -112,7 +101,7 @@ test_script_1 = """
|
||||
,fn_get_next_laptop_price(p.code) as price_for_next_code
|
||||
from rdb$database
|
||||
) x on 1=1;
|
||||
|
||||
|
||||
----------------------------
|
||||
|
||||
-- Check ability to use recursive datasource as LATERAL:
|
||||
@ -1468,35 +1457,35 @@ test_script_1 = """
|
||||
|
||||
"""
|
||||
|
||||
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
|
||||
act = isql_act('db', test_script, substitutions=[('[ \t]+', ' '), ('===.*', '')])
|
||||
|
||||
expected_stdout_1 = """
|
||||
MSG CODE MODEL SPEED RAM HD PRICE SCREEN MAX_PRICE MIN_PRICE
|
||||
test-1 1 1298 350 32 4.000000000000000 700.00 11 1150.00 700.00
|
||||
test-1 2 1321 500 64 8.000000000000000 970.00 12 970.00 970.00
|
||||
test-1 3 1750 750 128 12.00000000000000 1200.00 14 1200.00 1200.00
|
||||
test-1 4 1298 600 64 10.00000000000000 1050.00 15 1150.00 700.00
|
||||
test-1 5 1752 750 128 10.00000000000000 1150.00 14 1150.00 700.00
|
||||
test-1 6 1298 450 64 10.00000000000000 950.00 12 1150.00 700.00
|
||||
expected_stdout = """
|
||||
MSG CODE MODEL SPEED RAM HD PRICE SCREEN MAX_PRICE MIN_PRICE
|
||||
test-1 1 1298 350 32 4.000000000000000 700.00 11 1150.00 700.00
|
||||
test-1 2 1321 500 64 8.000000000000000 970.00 12 970.00 970.00
|
||||
test-1 3 1750 750 128 12.00000000000000 1200.00 14 1200.00 1200.00
|
||||
test-1 4 1298 600 64 10.00000000000000 1050.00 15 1150.00 700.00
|
||||
test-1 5 1752 750 128 10.00000000000000 1150.00 14 1150.00 700.00
|
||||
test-1 6 1298 450 64 10.00000000000000 950.00 12 1150.00 700.00
|
||||
|
||||
MSG CURR_CORE LEAD_CODE
|
||||
test-2 1 4
|
||||
test-2 4 6
|
||||
test-2 6 2
|
||||
test-2 2 3
|
||||
test-2 3 5
|
||||
test-2 5 <null>
|
||||
MSG CURR_CORE LEAD_CODE
|
||||
test-2 1 4
|
||||
test-2 4 6
|
||||
test-2 6 2
|
||||
test-2 2 3
|
||||
test-2 3 5
|
||||
test-2 5 <null>
|
||||
|
||||
MSG MAKER MODEL TYPE
|
||||
test-3 A 1298 Laptop
|
||||
test-3 C 1321 Laptop
|
||||
test-3 B 1750 Laptop
|
||||
test-3 B 1121 PC
|
||||
test-3 A 1232 PC
|
||||
test-3 A 1233 PC
|
||||
test-3 A 1276 Printer
|
||||
test-3 D 1288 Printer
|
||||
test-3 A 1401 Printer
|
||||
MSG MAKER MODEL TYPE
|
||||
test-3 A 1298 Laptop
|
||||
test-3 C 1321 Laptop
|
||||
test-3 B 1750 Laptop
|
||||
test-3 B 1121 PC
|
||||
test-3 A 1232 PC
|
||||
test-3 A 1233 PC
|
||||
test-3 A 1276 Printer
|
||||
test-3 D 1288 Printer
|
||||
test-3 A 1401 Printer
|
||||
|
||||
MSG CODE MODEL SPEED PRICE MODEL_FOR_NEXT_CODE SPEED_FOR_NEXT_CODE PRICE_FOR_NEXT_CODE
|
||||
test-4 1 1298 350 700.00 1321 500 970.00
|
||||
@ -1519,266 +1508,266 @@ expected_stdout_1 = """
|
||||
test-5 2 3
|
||||
test-5 1 1
|
||||
|
||||
I0 1
|
||||
I1 2
|
||||
I2 3
|
||||
I3 4
|
||||
I4 5
|
||||
I5 6
|
||||
I6 7
|
||||
I7 8
|
||||
I8 9
|
||||
I9 10
|
||||
I10 11
|
||||
I11 12
|
||||
I12 13
|
||||
I13 14
|
||||
I14 15
|
||||
I15 16
|
||||
I16 17
|
||||
I17 18
|
||||
I18 19
|
||||
I19 20
|
||||
I20 21
|
||||
I21 22
|
||||
I22 23
|
||||
I23 24
|
||||
I24 25
|
||||
I25 26
|
||||
I26 27
|
||||
I27 28
|
||||
I28 29
|
||||
I29 30
|
||||
I30 31
|
||||
I31 32
|
||||
I32 33
|
||||
I33 34
|
||||
I34 35
|
||||
I35 36
|
||||
I36 37
|
||||
I37 38
|
||||
I38 39
|
||||
I39 40
|
||||
I40 41
|
||||
I41 42
|
||||
I42 43
|
||||
I43 44
|
||||
I44 45
|
||||
I45 46
|
||||
I46 47
|
||||
I47 48
|
||||
I48 49
|
||||
I49 50
|
||||
I50 51
|
||||
I51 52
|
||||
I52 53
|
||||
I53 54
|
||||
I54 55
|
||||
I55 56
|
||||
I56 57
|
||||
I57 58
|
||||
I58 59
|
||||
I59 60
|
||||
I60 61
|
||||
I61 62
|
||||
I62 63
|
||||
I63 64
|
||||
I64 65
|
||||
I65 66
|
||||
I66 67
|
||||
I67 68
|
||||
I68 69
|
||||
I69 70
|
||||
I70 71
|
||||
I71 72
|
||||
I72 73
|
||||
I73 74
|
||||
I74 75
|
||||
I75 76
|
||||
I76 77
|
||||
I77 78
|
||||
I78 79
|
||||
I79 80
|
||||
I80 81
|
||||
I81 82
|
||||
I82 83
|
||||
I83 84
|
||||
I84 85
|
||||
I85 86
|
||||
I86 87
|
||||
I87 88
|
||||
I88 89
|
||||
I89 90
|
||||
I90 91
|
||||
I91 92
|
||||
I92 93
|
||||
I93 94
|
||||
I94 95
|
||||
I95 96
|
||||
I96 97
|
||||
I97 98
|
||||
I98 99
|
||||
I99 100
|
||||
I100 101
|
||||
I101 102
|
||||
I102 103
|
||||
I103 104
|
||||
I104 105
|
||||
I105 106
|
||||
I106 107
|
||||
I107 108
|
||||
I108 109
|
||||
I109 110
|
||||
I110 111
|
||||
I111 112
|
||||
I112 113
|
||||
I113 114
|
||||
I114 115
|
||||
I115 116
|
||||
I116 117
|
||||
I117 118
|
||||
I118 119
|
||||
I119 120
|
||||
I120 121
|
||||
I121 122
|
||||
I122 123
|
||||
I123 124
|
||||
I124 125
|
||||
I125 126
|
||||
I126 127
|
||||
I127 128
|
||||
I128 129
|
||||
I129 130
|
||||
I130 131
|
||||
I131 132
|
||||
I132 133
|
||||
I133 134
|
||||
I134 135
|
||||
I135 136
|
||||
I136 137
|
||||
I137 138
|
||||
I138 139
|
||||
I139 140
|
||||
I140 141
|
||||
I141 142
|
||||
I142 143
|
||||
I143 144
|
||||
I144 145
|
||||
I145 146
|
||||
I146 147
|
||||
I147 148
|
||||
I148 149
|
||||
I149 150
|
||||
I150 151
|
||||
I151 152
|
||||
I152 153
|
||||
I153 154
|
||||
I154 155
|
||||
I155 156
|
||||
I156 157
|
||||
I157 158
|
||||
I158 159
|
||||
I159 160
|
||||
I160 161
|
||||
I161 162
|
||||
I162 163
|
||||
I163 164
|
||||
I164 165
|
||||
I165 166
|
||||
I166 167
|
||||
I167 168
|
||||
I168 169
|
||||
I169 170
|
||||
I170 171
|
||||
I171 172
|
||||
I172 173
|
||||
I173 174
|
||||
I174 175
|
||||
I175 176
|
||||
I176 177
|
||||
I177 178
|
||||
I178 179
|
||||
I179 180
|
||||
I180 181
|
||||
I181 182
|
||||
I182 183
|
||||
I183 184
|
||||
I184 185
|
||||
I185 186
|
||||
I186 187
|
||||
I187 188
|
||||
I188 189
|
||||
I189 190
|
||||
I190 191
|
||||
I191 192
|
||||
I192 193
|
||||
I193 194
|
||||
I194 195
|
||||
I195 196
|
||||
I196 197
|
||||
I197 198
|
||||
I198 199
|
||||
I199 200
|
||||
I200 201
|
||||
I201 202
|
||||
I202 203
|
||||
I203 204
|
||||
I204 205
|
||||
I205 206
|
||||
I206 207
|
||||
I207 208
|
||||
I208 209
|
||||
I209 210
|
||||
I210 211
|
||||
I211 212
|
||||
I212 213
|
||||
I213 214
|
||||
I214 215
|
||||
I215 216
|
||||
I216 217
|
||||
I217 218
|
||||
I218 219
|
||||
I219 220
|
||||
I220 221
|
||||
I221 222
|
||||
I222 223
|
||||
I223 224
|
||||
I224 225
|
||||
I225 226
|
||||
I226 227
|
||||
I227 228
|
||||
I228 229
|
||||
I229 230
|
||||
I230 231
|
||||
I231 232
|
||||
I232 233
|
||||
I233 234
|
||||
I234 235
|
||||
I235 236
|
||||
I236 237
|
||||
I237 238
|
||||
I238 239
|
||||
I239 240
|
||||
I240 241
|
||||
I241 242
|
||||
I242 243
|
||||
I243 244
|
||||
I244 245
|
||||
I245 246
|
||||
I246 247
|
||||
I247 248
|
||||
I248 249
|
||||
I249 250
|
||||
I250 251
|
||||
I251 252
|
||||
I252 253
|
||||
I253 254
|
||||
I254 255
|
||||
I0 1
|
||||
I1 2
|
||||
I2 3
|
||||
I3 4
|
||||
I4 5
|
||||
I5 6
|
||||
I6 7
|
||||
I7 8
|
||||
I8 9
|
||||
I9 10
|
||||
I10 11
|
||||
I11 12
|
||||
I12 13
|
||||
I13 14
|
||||
I14 15
|
||||
I15 16
|
||||
I16 17
|
||||
I17 18
|
||||
I18 19
|
||||
I19 20
|
||||
I20 21
|
||||
I21 22
|
||||
I22 23
|
||||
I23 24
|
||||
I24 25
|
||||
I25 26
|
||||
I26 27
|
||||
I27 28
|
||||
I28 29
|
||||
I29 30
|
||||
I30 31
|
||||
I31 32
|
||||
I32 33
|
||||
I33 34
|
||||
I34 35
|
||||
I35 36
|
||||
I36 37
|
||||
I37 38
|
||||
I38 39
|
||||
I39 40
|
||||
I40 41
|
||||
I41 42
|
||||
I42 43
|
||||
I43 44
|
||||
I44 45
|
||||
I45 46
|
||||
I46 47
|
||||
I47 48
|
||||
I48 49
|
||||
I49 50
|
||||
I50 51
|
||||
I51 52
|
||||
I52 53
|
||||
I53 54
|
||||
I54 55
|
||||
I55 56
|
||||
I56 57
|
||||
I57 58
|
||||
I58 59
|
||||
I59 60
|
||||
I60 61
|
||||
I61 62
|
||||
I62 63
|
||||
I63 64
|
||||
I64 65
|
||||
I65 66
|
||||
I66 67
|
||||
I67 68
|
||||
I68 69
|
||||
I69 70
|
||||
I70 71
|
||||
I71 72
|
||||
I72 73
|
||||
I73 74
|
||||
I74 75
|
||||
I75 76
|
||||
I76 77
|
||||
I77 78
|
||||
I78 79
|
||||
I79 80
|
||||
I80 81
|
||||
I81 82
|
||||
I82 83
|
||||
I83 84
|
||||
I84 85
|
||||
I85 86
|
||||
I86 87
|
||||
I87 88
|
||||
I88 89
|
||||
I89 90
|
||||
I90 91
|
||||
I91 92
|
||||
I92 93
|
||||
I93 94
|
||||
I94 95
|
||||
I95 96
|
||||
I96 97
|
||||
I97 98
|
||||
I98 99
|
||||
I99 100
|
||||
I100 101
|
||||
I101 102
|
||||
I102 103
|
||||
I103 104
|
||||
I104 105
|
||||
I105 106
|
||||
I106 107
|
||||
I107 108
|
||||
I108 109
|
||||
I109 110
|
||||
I110 111
|
||||
I111 112
|
||||
I112 113
|
||||
I113 114
|
||||
I114 115
|
||||
I115 116
|
||||
I116 117
|
||||
I117 118
|
||||
I118 119
|
||||
I119 120
|
||||
I120 121
|
||||
I121 122
|
||||
I122 123
|
||||
I123 124
|
||||
I124 125
|
||||
I125 126
|
||||
I126 127
|
||||
I127 128
|
||||
I128 129
|
||||
I129 130
|
||||
I130 131
|
||||
I131 132
|
||||
I132 133
|
||||
I133 134
|
||||
I134 135
|
||||
I135 136
|
||||
I136 137
|
||||
I137 138
|
||||
I138 139
|
||||
I139 140
|
||||
I140 141
|
||||
I141 142
|
||||
I142 143
|
||||
I143 144
|
||||
I144 145
|
||||
I145 146
|
||||
I146 147
|
||||
I147 148
|
||||
I148 149
|
||||
I149 150
|
||||
I150 151
|
||||
I151 152
|
||||
I152 153
|
||||
I153 154
|
||||
I154 155
|
||||
I155 156
|
||||
I156 157
|
||||
I157 158
|
||||
I158 159
|
||||
I159 160
|
||||
I160 161
|
||||
I161 162
|
||||
I162 163
|
||||
I163 164
|
||||
I164 165
|
||||
I165 166
|
||||
I166 167
|
||||
I167 168
|
||||
I168 169
|
||||
I169 170
|
||||
I170 171
|
||||
I171 172
|
||||
I172 173
|
||||
I173 174
|
||||
I174 175
|
||||
I175 176
|
||||
I176 177
|
||||
I177 178
|
||||
I178 179
|
||||
I179 180
|
||||
I180 181
|
||||
I181 182
|
||||
I182 183
|
||||
I183 184
|
||||
I184 185
|
||||
I185 186
|
||||
I186 187
|
||||
I187 188
|
||||
I188 189
|
||||
I189 190
|
||||
I190 191
|
||||
I191 192
|
||||
I192 193
|
||||
I193 194
|
||||
I194 195
|
||||
I195 196
|
||||
I196 197
|
||||
I197 198
|
||||
I198 199
|
||||
I199 200
|
||||
I200 201
|
||||
I201 202
|
||||
I202 203
|
||||
I203 204
|
||||
I204 205
|
||||
I205 206
|
||||
I206 207
|
||||
I207 208
|
||||
I208 209
|
||||
I209 210
|
||||
I210 211
|
||||
I211 212
|
||||
I212 213
|
||||
I213 214
|
||||
I214 215
|
||||
I215 216
|
||||
I216 217
|
||||
I217 218
|
||||
I218 219
|
||||
I219 220
|
||||
I220 221
|
||||
I221 222
|
||||
I222 223
|
||||
I223 224
|
||||
I224 225
|
||||
I225 226
|
||||
I226 227
|
||||
I227 228
|
||||
I228 229
|
||||
I229 230
|
||||
I230 231
|
||||
I231 232
|
||||
I232 233
|
||||
I233 234
|
||||
I234 235
|
||||
I235 236
|
||||
I236 237
|
||||
I237 238
|
||||
I238 239
|
||||
I239 240
|
||||
I240 241
|
||||
I241 242
|
||||
I242 243
|
||||
I243 244
|
||||
I244 245
|
||||
I245 246
|
||||
I246 247
|
||||
I247 248
|
||||
I248 249
|
||||
I249 250
|
||||
I250 251
|
||||
I251 252
|
||||
I252 253
|
||||
I253 254
|
||||
I254 255
|
||||
"""
|
||||
|
||||
@pytest.mark.version('>=4.0.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('>=4.0')
|
||||
def test_1(act: Action):
|
||||
act.expected_stdout = expected_stdout
|
||||
act.execute()
|
||||
assert act.clean_stdout == act.clean_expected_stdout
|
||||
|
||||
|
@ -1,22 +1,19 @@
|
||||
#coding:utf-8
|
||||
#
|
||||
# id: bugs.core_3446
|
||||
# title: Allow conversion from/to BLOBs and others types in the API functions (XSQLVAR or blr messages)
|
||||
# decription: We try to write varchar value into blob field and vice-versa, using execute statement with parameters of corresp. types
|
||||
# tracker_id: CORE-3446
|
||||
# min_versions: ['2.5.3']
|
||||
# versions: 2.5.3
|
||||
# qmid: None
|
||||
|
||||
"""
|
||||
ID: issue-3807
|
||||
ISSUE: 3807
|
||||
TITLE: Allow conversion from/to BLOBs and others types in the API functions (XSQLVAR or blr messages)
|
||||
DESCRIPTION:
|
||||
We try to write varchar value into blob field and vice-versa, using execute statement
|
||||
with parameters of corresp. types
|
||||
JIRA: CORE-3446
|
||||
"""
|
||||
|
||||
import pytest
|
||||
from firebird.qa import db_factory, isql_act, Action
|
||||
from firebird.qa import *
|
||||
|
||||
# version: 2.5.3
|
||||
# resources: None
|
||||
|
||||
substitutions_1 = [('B_NEW.*', '')]
|
||||
|
||||
init_script_1 = """
|
||||
init_script = """
|
||||
recreate table test( s varchar(8187) character set utf8 collate unicode_ci_ai, b blob sub_type 1 character set utf8 collate unicode_ci_ai);
|
||||
commit;
|
||||
|
||||
@ -290,12 +287,12 @@ rapporté à son maître par le porteur du présent.
|
||||
Togané, d''où on les expédierait à Yedo.
|
||||
'
|
||||
);
|
||||
commit;
|
||||
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 = """
|
||||
set list on;
|
||||
set blob all;
|
||||
set term ^;
|
||||
@ -313,7 +310,7 @@ test_script_1 = """
|
||||
into s_new, b_new;
|
||||
suspend;
|
||||
end
|
||||
^ set term ;^
|
||||
^ set term ;^
|
||||
-- 2.5.0:
|
||||
-- Statement failed, SQLSTATE = 0A000
|
||||
-- Dynamic SQL Error
|
||||
@ -330,17 +327,17 @@ test_script_1 = """
|
||||
-- -block size exceeds implementation restriction
|
||||
"""
|
||||
|
||||
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
|
||||
act = isql_act('db', test_script, substitutions=[('B_NEW.*', '')])
|
||||
|
||||
expected_stdout_1 = """
|
||||
expected_stdout = """
|
||||
S_NEW ||
|
||||
B_NEW 0:f
|
||||
||
|
||||
||
|
||||
"""
|
||||
|
||||
@pytest.mark.version('>=2.5.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
|
||||
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user