FirebirdSQL / firebird

Firebird server, client and tools
https://firebirdsql.org
1.26k stars 217 forks source link

Reimplement system triggers in C++/GDML code #8202

Closed asfernandes closed 3 months ago

asfernandes commented 3 months ago

I have validated this branch with firebird-qa and the differences with master are:

tests.bugs.core_4731_test: with firebird-qa inserts records in rdb$types with rdb$system_flag (not nullable) set to null and expect the records there. Firebird was wrong due to not create rdb$runtime field for it due to no system triggers for this table - now fixed in Firebird code.


tests.bugs.core_4725_test tests.functional.gtcs.test_ref_integ_drop_fk_index tests.functional.gtcs.test_ref_integ_drop_pk_constraint tests.functional.gtcs.test_ref_integ_drop_pk_index tests.functional.gtcs.test_ref_integ_inactive_fk_index tests.functional.gtcs.test_ref_integ_inactive_pk_index tests.functional.gtcs.test_ref_integ_inactive_pk_index_2 tests.functional.index.alter.test_04 tests.functional.index.alter.test_05

These tests excepts in some operations SQLSTATE = 27000 but now Firebird returns 42000. The change is correct as 27000 is related to the error "action cancelled by system trigger" and not the actual SQLSTATE associated with the error.

CC @pavel-zotov

pavel-zotov commented 3 months ago

tests.bugs.core_4731_test: with firebird-qa inserts records ... Firebird was wrong ... now fixed in Firebird code.

I see result = 'passed' for this test on 6.0.0.419-3505a5ec and 6.0.0.421-ed60d4d. Nothing to do with it ?

Following:

tests.bugs.core_4725_test tests.functional.gtcs.test_ref_integ_drop_fk_index . . . tests.functional.index.alter.test_04 tests.functional.index.alter.test_05 These tests excepts in some operations SQLSTATE = 27000 but now Firebird returns 42000

-- have been adjusted with current output in FB 6.x

asfernandes commented 3 months ago

tests.bugs.core_4731_test: with firebird-qa inserts records ... Firebird was wrong ... now fixed in Firebird code.

I see result = 'passed' for this test on 6.0.0.419-3505a5ec and 6.0.0.421-ed60d4d. Nothing to do with it ?

Without changes for me:

E       AssertionError: assert   
E           -- Executed with role: NONE. Expressions that passes WITHOUT errors:
E           -- count_of_passed:             0
E           -- gdscode list for blocked:    335544926
E           -- Executed with role: RDB$ADMIN. Expressions that passes WITHOUT errors:
E         - -- count_of_passed:             24
E         ?                                 ^\n
E         + -- count_of_passed:             14
E         ?                                 ^\n
E           VULNERABLE_EXPR                 delete from RDB$BACKUP_HISTORY t  rows 1 returning t.rdb$db_key; -- length of returned rdb$dbkey=8
E           VULNERABLE_EXPR                 insert into RDB$BACKUP_HISTORY(RDB$BACKUP_ID , RDB$TIMESTAMP , RDB$BACKUP_LEVEL , RDB$GUID , RDB$SCN , RDB$FILE_NAME) values(null, null, null, null, null, null) returning rdb$db_key; -- length of returned rdb$dbkey=8
E           VULNERABLE_EXPR                 delete from RDB$DB_CREATORS t  rows 1 returning t.rdb$db_key; -- length of returned rdb$dbkey=8
E           VULNERABLE_EXPR                 insert into RDB$DB_CREATORS(RDB$USER , RDB$USER_TYPE) values(null, null) returning rdb$db_key; -- length of returned rdb$dbkey=8
E           VULNERABLE_EXPR                 update RDB$DB_CREATORS t  set t.RDB$USER = 'C'  rows 1 returning t.rdb$db_key; -- length of returned rdb$dbkey=8
E           VULNERABLE_EXPR                 update RDB$DB_CREATORS t  set t.RDB$USER = null  rows 1 returning t.rdb$db_key; -- length of returned rdb$dbkey=8
E           VULNERABLE_EXPR                 update RDB$DB_CREATORS t  set t.RDB$USER_TYPE = 32767  rows 1 returning t.rdb$db_key; -- length of returned rdb$dbkey=8
E           VULNERABLE_EXPR                 update RDB$DB_CREATORS t  set t.RDB$USER_TYPE = null  rows 1 returning t.rdb$db_key; -- length of returned rdb$dbkey=8
E           VULNERABLE_EXPR                 update RDB$FUNCTIONS t  set t.RDB$FUNCTION_SOURCE = null where coalesce(rdb$system_flag,0)=0 rows 1 returning t.rdb$db_key; -- length of returned rdb$dbkey=8
E           VULNERABLE_EXPR                 update RDB$PACKAGES t  set t.RDB$PACKAGE_BODY_SOURCE = null where coalesce(rdb$system_flag,0)=0 rows 1 returning t.rdb$db_key; -- length of returned rdb$dbkey=8
E           VULNERABLE_EXPR                 update RDB$PACKAGES t  set t.RDB$PACKAGE_HEADER_SOURCE = null where coalesce(rdb$system_flag,0)=0 rows 1 returning t.rdb$db_key; -- length of returned rdb$dbkey=8
E           VULNERABLE_EXPR                 update RDB$PROCEDURES t  set t.RDB$PROCEDURE_SOURCE = null where coalesce(rdb$system_flag,0)=0 rows 1 returning t.rdb$db_key; -- length of returned rdb$dbkey=8
E           VULNERABLE_EXPR                 update RDB$RELATIONS t  set t.RDB$VIEW_SOURCE = null where coalesce(rdb$system_flag,0)=0 rows 1 returning t.rdb$db_key; -- length of returned rdb$dbkey=8
E           VULNERABLE_EXPR                 update RDB$TRIGGERS t  set t.RDB$TRIGGER_SOURCE = null where coalesce(rdb$system_flag,0)=0 rows 1 returning t.rdb$db_key; -- length of returned rdb$dbkey=8
E         - VULNERABLE_EXPR                 insert into RDB$TYPES(RDB$FIELD_NAME , RDB$TYPE , RDB$TYPE_NAME , RDB$DESCRIPTION , RDB$SYSTEM_FLAG) values(null, null, null, null, null) returning rdb$db_key; -- length of returned rdb$dbkey=8
E         - VULNERABLE_EXPR                 update RDB$TYPES t  set t.RDB$DESCRIPTION = 'test_for_blob' where coalesce(rdb$system_flag,0)=0 rows 1 returning t.rdb$db_key; -- length of returned rdb$dbkey=8
E         - VULNERABLE_EXPR                 update RDB$TYPES t  set t.RDB$DESCRIPTION = null where coalesce(rdb$system_flag,0)=0 rows 1 returning t.rdb$db_key; -- length of returned rdb$dbkey=8
E         - VULNERABLE_EXPR                 update RDB$TYPES t  set t.RDB$FIELD_NAME = 'C' where coalesce(rdb$system_flag,0)=0 rows 1 returning t.rdb$db_key; -- length of returned rdb$dbkey=8
E         - VULNERABLE_EXPR                 update RDB$TYPES t  set t.RDB$FIELD_NAME = null where coalesce(rdb$system_flag,0)=0 rows 1 returning t.rdb$db_key; -- length of returned rdb$dbkey=8
E         - VULNERABLE_EXPR                 update RDB$TYPES t  set t.RDB$SYSTEM_FLAG = 32767 where coalesce(rdb$system_flag,0)=0 rows 1 returning t.rdb$db_key; -- length of returned rdb$dbkey=8
E         - VULNERABLE_EXPR                 update RDB$TYPES t  set t.RDB$TYPE = 32767 where coalesce(rdb$system_flag,0)=0 rows 1 returning t.rdb$db_key; -- length of returned rdb$dbkey=8
E         - VULNERABLE_EXPR                 update RDB$TYPES t  set t.RDB$TYPE = null where coalesce(rdb$system_flag,0)=0 rows 1 returning t.rdb$db_key; -- length of returned rdb$dbkey=8
E         - VULNERABLE_EXPR                 update RDB$TYPES t  set t.RDB$TYPE_NAME = 'C' where coalesce(rdb$system_flag,0)=0 rows 1 returning t.rdb$db_key; -- length of returned rdb$dbkey=8
E         - VULNERABLE_EXPR                 update RDB$TYPES t  set t.RDB$TYPE_NAME = null where coalesce(rdb$system_flag,0)=0 rows 1 returning t.rdb$db_key; -- length of returned rdb$dbkey=8
E           -- gdscode list for blocked:    335544926
pavel-zotov commented 3 months ago

Without changes for me: ... E - -- count_of_passed: 24 E + -- count_of_passed: 14

For which snapshot number this test issued "count_of_passed: 14" ? I still see old (24): image

Used config:

AuthServer = Srp, Win_Sspi, Legacy_Auth
BugCheckAbort = 1
ClearGTTAtRetaining = 0
ClientBatchBuffer = 131072
ConnectionIdleTimeout = 0
DefaultDBCachePages = 10K
ExtConnPoolLifeTime = 10
ExtConnPoolSize = 10
ExternalFileAccess = Full
InlineSortThreshold = 1000
IpcName = xnet_fb6x_ss
KeyHolderPlugin = fbSampleKeyHolder
MaxIdentifierByteLength = 252
MaxIdentifierCharLength = 63
MaxParallelWorkers = 8
MaxUnflushedWrites = -1
MaxUnflushedWriteTime = -1
ParallelWorkers = 1
ReadConsistency = 0
RemoteServicePort = 3600
ServerMode = Super
SnapshotsMemSize = 64K
StatementTimeout = 300
TempCacheLimit = 1G
TipCacheBlockSize = 4M
UseFileSystemCache = true
UserManager = Srp, Legacy_UserManager
WireCrypt = Enabled
WireCryptPlugin = ChaCha, Arc4

Also, no problem with this test on firebirdtest.com page: image

pavel-zotov commented 3 months ago

I still see old (24):

Sorry, i've found the reason. Will fix that.