Changeset: 8049a0ff4f71 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/8049a0ff4f71 Modified Files: clients/Tests/MAL-signatures-hge.test monetdb5/mal/mal_instruction.c sql/backends/monet5/sql_execute.c sql/test/BugTracker-2024/Tests/atom_cmp-Bug-7477.test Branch: no_type_bat Log Message:
fix a crash in mal execution. Some instructions weren't properly cleaned. diffs (210 lines): diff --git a/clients/Tests/MAL-signatures-hge.test b/clients/Tests/MAL-signatures-hge.test --- a/clients/Tests/MAL-signatures-hge.test +++ b/clients/Tests/MAL-signatures-hge.test @@ -50125,7 +50125,12 @@ SQLwindow_bound; computes window ranges for each row sqlcatalog alter_add_range_partition -pattern sqlcatalog.alter_add_range_partition(X_0:str, X_1:str, X_2:str, X_3:str, X_4:any_1, X_5:any_1, X_6:bit, X_7:int):void +pattern sqlcatalog.alter_add_range_partition(X_0:str, X_1:str, X_2:str, X_3:str, X_4:any_1, X_5:any_1, X_6:bit, X_7:int, X_8:bat[:lng]):void +SQLalter_add_range_partition; +Catalog operation alter_add_range_partition +sqlcatalog +alter_add_range_partition +pattern sqlcatalog.alter_add_range_partition(X_0:str, X_1:str, X_2:str, X_3:str, X_4:any_1, X_5:any_1, X_6:bit, X_7:int, X_8:lng):void SQLalter_add_range_partition; Catalog operation alter_add_range_partition sqlcatalog @@ -50135,12 +50140,22 @@ SQLalter_add_table; Catalog operation alter_add_table sqlcatalog alter_add_value_partition -pattern sqlcatalog.alter_add_value_partition(X_0:str, X_1:str, X_2:str, X_3:str, X_4:bit, X_5:int):void +pattern sqlcatalog.alter_add_value_partition(X_0:str, X_1:str, X_2:str, X_3:str, X_4:bit, X_5:int, X_6:bat[:lng]):void SQLalter_add_value_partition; Catalog operation alter_add_value_partition sqlcatalog alter_add_value_partition -pattern sqlcatalog.alter_add_value_partition(X_0:str, X_1:str, X_2:str, X_3:str, X_4:bit, X_5:int, X_6:any...):void +pattern sqlcatalog.alter_add_value_partition(X_0:str, X_1:str, X_2:str, X_3:str, X_4:bit, X_5:int, X_6:bat[:lng], X_7:any...):void +SQLalter_add_value_partition; +Catalog operation alter_add_value_partition +sqlcatalog +alter_add_value_partition +pattern sqlcatalog.alter_add_value_partition(X_0:str, X_1:str, X_2:str, X_3:str, X_4:bit, X_5:int, X_6:lng):void +SQLalter_add_value_partition; +Catalog operation alter_add_value_partition +sqlcatalog +alter_add_value_partition +pattern sqlcatalog.alter_add_value_partition(X_0:str, X_1:str, X_2:str, X_3:str, X_4:bit, X_5:int, X_6:lng, X_7:any...):void SQLalter_add_value_partition; Catalog operation alter_add_value_partition sqlcatalog @@ -50362,17 +50377,7 @@ str contains pattern str.contains(X_0:str, X_1:str, X_2:bit):bit STRcontains; -Check if string chaystack contains string needle, icase flag. -str -containsjoin -pattern str.containsjoin(X_0:bat[:str], X_1:bat[:str], X_2:bat[:bit], X_3:bat[:oid], X_4:bat[:oid], X_5:bit, X_6:lng, X_7:bit):bat[:oid] -STRcontainsjoin1; -The same as STRcontainsjoin, but only produce one output + icase. -str -containsjoin -pattern str.containsjoin(X_0:bat[:str], X_1:bat[:str], X_2:bat[:oid], X_3:bat[:oid], X_4:bit, X_5:lng, X_6:bit):bat[:oid] -STRcontainsjoin1; -The same as STRcontainsjoin, but only produce one output. +Check if string haystack contains string needle, icase flag. str containsjoin pattern str.containsjoin(X_0:bat[:str], X_1:bat[:str], X_2:bat[:bit], X_3:bat[:oid], X_4:bat[:oid], X_5:bit, X_6:lng, X_7:bit) (X_8:bat[:oid], X_9:bat[:oid]) @@ -50380,10 +50385,20 @@ STRcontainsjoin; Join the string bat L with the bat R if L contains the string of R@with optional candidate lists SL and SR@The result is two aligned bats with oids of matching rows + icase. str containsjoin +pattern str.containsjoin(X_0:bat[:str], X_1:bat[:str], X_2:bat[:bit], X_3:bat[:oid], X_4:bat[:oid], X_5:bit, X_6:lng, X_7:bit):bat[:oid] +STRcontainsjoin; +The same as STRcontainsjoin, but only produce one output + icase. +str +containsjoin pattern str.containsjoin(X_0:bat[:str], X_1:bat[:str], X_2:bat[:oid], X_3:bat[:oid], X_4:bit, X_5:lng, X_6:bit) (X_7:bat[:oid], X_8:bat[:oid]) STRcontainsjoin; Join the string bat L with the bat R if L contains the string of R@with optional candidate lists SL and SR@The result is two aligned bats with oids of matching rows. str +containsjoin +pattern str.containsjoin(X_0:bat[:str], X_1:bat[:str], X_2:bat[:oid], X_3:bat[:oid], X_4:bit, X_5:lng, X_6:bit):bat[:oid] +STRcontainsjoin; +The same as STRcontainsjoin, but only produce one output. +str containsselect pattern str.containsselect(X_0:bat[:str], X_1:bat[:oid], X_2:str, X_3:bit):bat[:oid] STRcontainsselect; @@ -50405,25 +50420,25 @@ STRendswith; Check if string ends with substring, icase flag. str endswithjoin -pattern str.endswithjoin(X_0:bat[:str], X_1:bat[:str], X_2:bat[:bit], X_3:bat[:oid], X_4:bat[:oid], X_5:bit, X_6:lng, X_7:bit):bat[:oid] -STRendswithjoin1; -The same as STRendswithjoin, but only produce one output + icase. -str -endswithjoin -pattern str.endswithjoin(X_0:bat[:str], X_1:bat[:str], X_2:bat[:oid], X_3:bat[:oid], X_4:bit, X_5:lng, X_6:bit):bat[:oid] -STRendswithjoin1; -The same as STRendswithjoin, but only produce one output. -str -endswithjoin pattern str.endswithjoin(X_0:bat[:str], X_1:bat[:str], X_2:bat[:bit], X_3:bat[:oid], X_4:bat[:oid], X_5:bit, X_6:lng, X_7:bit) (X_8:bat[:oid], X_9:bat[:oid]) STRendswithjoin; Join the string bat L with the suffix bat R@with optional candidate lists SL and SR@The result is two aligned bats with oids of matching rows + icase. str endswithjoin +pattern str.endswithjoin(X_0:bat[:str], X_1:bat[:str], X_2:bat[:bit], X_3:bat[:oid], X_4:bat[:oid], X_5:bit, X_6:lng, X_7:bit):bat[:oid] +STRendswithjoin; +The same as STRendswithjoin, but only produce one output + icase. +str +endswithjoin pattern str.endswithjoin(X_0:bat[:str], X_1:bat[:str], X_2:bat[:oid], X_3:bat[:oid], X_4:bit, X_5:lng, X_6:bit) (X_7:bat[:oid], X_8:bat[:oid]) STRendswithjoin; Join the string bat L with the suffix bat R@with optional candidate lists SL and SR@The result is two aligned bats with oids of matching rows. str +endswithjoin +pattern str.endswithjoin(X_0:bat[:str], X_1:bat[:str], X_2:bat[:oid], X_3:bat[:oid], X_4:bit, X_5:lng, X_6:bit):bat[:oid] +STRendswithjoin; +The same as STRendswithjoin, but only produce one output. +str endswithselect pattern str.endswithselect(X_0:bat[:str], X_1:bat[:oid], X_2:str, X_3:bit):bat[:oid] STRendswithselect; @@ -50575,25 +50590,25 @@ STRstartswith; Check if string starts with substring, icase flag. str startswithjoin -pattern str.startswithjoin(X_0:bat[:str], X_1:bat[:str], X_2:bat[:bit], X_3:bat[:oid], X_4:bat[:oid], X_5:bit, X_6:lng, X_7:bit):bat[:oid] -STRstartswithjoin1; -The same as STRstartswithjoin, but only produce one output + icase. -str -startswithjoin -pattern str.startswithjoin(X_0:bat[:str], X_1:bat[:str], X_2:bat[:oid], X_3:bat[:oid], X_4:bit, X_5:lng, X_6:bit):bat[:oid] -STRstartswithjoin1; -The same as STRstartswithjoin, but only produce one output. -str -startswithjoin pattern str.startswithjoin(X_0:bat[:str], X_1:bat[:str], X_2:bat[:bit], X_3:bat[:oid], X_4:bat[:oid], X_5:bit, X_6:lng, X_7:bit) (X_8:bat[:oid], X_9:bat[:oid]) STRstartswithjoin; Join the string bat L with the prefix bat R@with optional candidate lists SL and SR@The result is two aligned bats with oids of matching rows + icase. str startswithjoin +pattern str.startswithjoin(X_0:bat[:str], X_1:bat[:str], X_2:bat[:bit], X_3:bat[:oid], X_4:bat[:oid], X_5:bit, X_6:lng, X_7:bit):bat[:oid] +STRstartswithjoin; +The same as STRstartswithjoin, but only produce one output + icase. +str +startswithjoin pattern str.startswithjoin(X_0:bat[:str], X_1:bat[:str], X_2:bat[:oid], X_3:bat[:oid], X_4:bit, X_5:lng, X_6:bit) (X_7:bat[:oid], X_8:bat[:oid]) STRstartswithjoin; Join the string bat L with the prefix bat R@with optional candidate lists SL and SR@The result is two aligned bats with oids of matching rows. str +startswithjoin +pattern str.startswithjoin(X_0:bat[:str], X_1:bat[:str], X_2:bat[:oid], X_3:bat[:oid], X_4:bit, X_5:lng, X_6:bit):bat[:oid] +STRstartswithjoin; +The same as STRstartswithjoin, but only produce one output. +str startswithselect pattern str.startswithselect(X_0:bat[:str], X_1:bat[:oid], X_2:str, X_3:bit):bat[:oid] STRstartswithselect; diff --git a/monetdb5/mal/mal_instruction.c b/monetdb5/mal/mal_instruction.c --- a/monetdb5/mal/mal_instruction.c +++ b/monetdb5/mal/mal_instruction.c @@ -211,7 +211,7 @@ resetMalBlk(MalBlkPtr mb) InstrPtr *new; VarRecord *vnew; - for (i = MALCHUNK; i < mb->ssize; i++) { + for (i = 1/*MALCHUNK*/; i < mb->ssize; i++) { freeInstruction(mb->stmt[i]); mb->stmt[i] = NULL; } @@ -228,7 +228,7 @@ resetMalBlk(MalBlkPtr mb) mb->ssize = MALCHUNK; } /* Reuse the initial function statement */ - mb->stop = 0; + mb->stop = 1; for (i = 0; i < mb->vtop; i++) { if (mb->var[i].name) diff --git a/sql/backends/monet5/sql_execute.c b/sql/backends/monet5/sql_execute.c --- a/sql/backends/monet5/sql_execute.c +++ b/sql/backends/monet5/sql_execute.c @@ -541,8 +541,11 @@ SQLstatementIntern(Client c, const char be->depth++; msg = SQLrun(c,m); be->depth--; - MSresetInstructions(c->curprg->def, oldstop); - freeVariables(c, c->curprg->def, NULL, oldvtop); + if (c->curprg->def->stop > 1) { + assert(0); + MSresetInstructions(c->curprg->def, oldstop); + freeVariables(c, c->curprg->def, NULL, oldvtop); + } sqlcleanup(sql, 0); if (!execute) goto endofcompile; diff --git a/sql/test/BugTracker-2024/Tests/atom_cmp-Bug-7477.test b/sql/test/BugTracker-2024/Tests/atom_cmp-Bug-7477.test --- a/sql/test/BugTracker-2024/Tests/atom_cmp-Bug-7477.test +++ b/sql/test/BugTracker-2024/Tests/atom_cmp-Bug-7477.test @@ -1,5 +1,5 @@ -- trying first without function "abs ( x )" -statement error TypeException:user.main[12]:'calc.==' undefined in: X_0:bit := calc.==(X_1:str, X_2:bte); +statement error TypeException:user.main[12]:'calc.==' undefined in: X_20:bit := calc.==(X_17:str, X_18:bte); SELECT - 66 x GROUP BY x HAVING ( x IN ( SELECT '' x WHERE ( x = ( x = 1 ) ) UNION SELECT 1 ) ) -- changing '' into 1, so a string into int @@ -14,6 +14,6 @@ SELECT - 66 x GROUP BY x HAVING ( abs ( -66 skipif knownfail -statement error TypeException:user.main[12]:'calc.==' undefined in: X_0:bit := calc.==(X_1:str, X_2:bte); +statement error TypeException:user.main[12]:'calc.==' undefined in: X_0:bit := calc.==(X_1:str, X_2:bte) SELECT - 66 x GROUP BY x HAVING ( abs ( x ) IN ( SELECT '' x WHERE ( x = ( x = 1 ) ) UNION SELECT 1 ) ) _______________________________________________ checkin-list mailing list -- checkin-list@monetdb.org To unsubscribe send an email to checkin-list-le...@monetdb.org