MonetDB: default - desc/asc aren't reserved keywords ie need to ...
Changeset: 67e36bf046b2 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/67e36bf046b2 Modified Files: sql/server/sql_parser.y Branch: default Log Message: desc/asc aren't reserved keywords ie need to be added such that we can use those as table /column names diffs (28 lines): diff --git a/sql/server/sql_parser.y b/sql/server/sql_parser.y --- a/sql/server/sql_parser.y +++ b/sql/server/sql_parser.y @@ -5653,8 +5653,6 @@ ident: non_reserved_word: AS { $$ = sa_strdup(SA, "as"); } /* sloppy: officially reserved */ -| ASC { $$ = sa_strdup(SA, "asc"); } /* sloppy: officially reserved */ -| DESC { $$ = sa_strdup(SA, "desc"); } /* sloppy: officially reserved */ | AUTHORIZATION{ $$ = sa_strdup(SA, "authorization"); }/* sloppy: officially reserved */ | COLUMN { $$ = sa_strdup(SA, "column"); } /* sloppy: officially reserved */ | CYCLE{ $$ = sa_strdup(SA, "cycle"); }/* sloppy: officially reserved */ @@ -5683,6 +5681,7 @@ non_reserved_word: | ACTION { $$ = sa_strdup(SA, "action"); } | ANALYZE { $$ = sa_strdup(SA, "analyze"); } +| ASC { $$ = sa_strdup(SA, "asc"); } | AUTO_COMMIT { $$ = sa_strdup(SA, "auto_commit"); } | BIG { $$ = sa_strdup(SA, "big"); } | CACHE{ $$ = sa_strdup(SA, "cache"); } @@ -5691,6 +5690,7 @@ non_reserved_word: | COMMENT { $$ = sa_strdup(SA, "comment"); } | DATA { $$ = sa_strdup(SA, "data"); } | DECADE { $$ = sa_strdup(SA, "decade"); } +| DESC { $$ = sa_strdup(SA, "desc"); } | DIAGNOSTICS { $$ = sa_strdup(SA, "diagnostics"); } | DOW { $$ = sa_strdup(SA, "dow"); } | DOY { $$ = sa_strdup(SA, "doy"); } ___ checkin-list mailing list -- checkin-list@monetdb.org To unsubscribe send an email to checkin-list-le...@monetdb.org
MonetDB: Jun2023 - Server exiting is not an error.
Changeset: 52468ef1516e for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/52468ef1516e Modified Files: gdk/gdk_tracer.c monetdb5/mal/mal_exception.c Branch: Jun2023 Log Message: Server exiting is not an error. diffs (50 lines): diff --git a/gdk/gdk_tracer.c b/gdk/gdk_tracer.c --- a/gdk/gdk_tracer.c +++ b/gdk/gdk_tracer.c @@ -513,6 +513,7 @@ GDKtracer_log(const char *file, const ch va_list va; char ts[TS_SIZE]; char *msg = NULL; + bool isexit; static char file_prefix[] = __FILE__; static size_t prefix_length = (size_t) -1; @@ -550,6 +551,7 @@ GDKtracer_log(const char *file, const ch sizeof(buffer) - bytes_written, fmt, va); } + isexit = strstr(msg, EXITING_MSG) != NULL; va_end(va); if (bytes_written < 0) { if ((adapter_t) ATOMIC_GET(_adapter) != MBEDDED) @@ -567,7 +569,8 @@ GDKtracer_log(const char *file, const ch size_t n = strlen(buf); snprintf(buf + n, GDKMAXERRLEN - n, "%s%s: %s%s%s\n", -GDKERROR, func, msg, +isexit ? "" : GDKERROR, +func, msg, syserr ? ": " : "", syserr ? syserr : ""); } @@ -582,7 +585,7 @@ GDKtracer_log(const char *file, const ch reinit(); if (level <= M_WARNING || (ATOMIC_GET() & FORCEMITOMASK)) { - fprintf(level <= M_ERROR ? stderr : stdout, + fprintf(level <= M_ERROR && !isexit ? stderr : stdout, "#%s%s%s: %s: %s: %s%s%s\n", add_ts ? ts : "", add_ts ? ": " : "", diff --git a/monetdb5/mal/mal_exception.c b/monetdb5/mal/mal_exception.c --- a/monetdb5/mal/mal_exception.c +++ b/monetdb5/mal/mal_exception.c @@ -159,7 +159,7 @@ createException(enum malexception type, ret = createException(type, fcn, "%s", q + 2); } if (ret == NULL) - ret = createException(type, fcn, "GDK reported error: %s", p); + ret = createException(type, fcn, "GDK reported%s: %s", strstr(p, EXITING_MSG) == NULL ? " error" : "", p); GDKclrerr(); assert(ret); return ret; ___ checkin-list mailing list -- checkin-list@monetdb.org To unsubscribe send an email to checkin-list-le...@monetdb.org
MonetDB: Jun2023 - Added test for bug in older versions.
Changeset: bef7876f1d6e for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/bef7876f1d6e Added Files: sql/test/bugs/Tests/delete-or-not-in-bug.test Modified Files: sql/test/bugs/Tests/All Branch: Jun2023 Log Message: Added test for bug in older versions. diffs (63 lines): diff --git a/sql/test/bugs/Tests/All b/sql/test/bugs/Tests/All --- a/sql/test/bugs/Tests/All +++ b/sql/test/bugs/Tests/All @@ -115,3 +115,4 @@ rtrim_bug savepoint-release procedure-recompile rse_bug +delete-or-not-in-bug diff --git a/sql/test/bugs/Tests/delete-or-not-in-bug.test b/sql/test/bugs/Tests/delete-or-not-in-bug.test new file mode 100644 --- /dev/null +++ b/sql/test/bugs/Tests/delete-or-not-in-bug.test @@ -0,0 +1,50 @@ +statement ok +CREATE TABLE "sys"."foo" ( +"id" INTEGER NOT NULL, +"cid" INTEGER, +"ak" INTEGER, +"bk" INTEGER, +CONSTRAINT "foo_id_unique" UNIQUE ("id") +); + +statement ok +CREATE TABLE "sys"."bar" ( +"cid" INTEGER, +"akr" INTEGER, +"bkr" INTEGER +); + +statement ok +INSERT INTO foo VALUES (1, 9, 10, 12), (2, 9, 11, 13), (3, 10, 20, 25), (4, 10, 452, 435), (5, 9, 130, 140); + +statement ok +INSERT INTO bar VALUES (9, 120, 180), (3, 111, 134), (5, 183, 154), (9, 142, 182), (9, 102, 134); + +query +select * FROM foo WHERE cid = 9 AND ((ak NOT IN (SELECT akr FROM bar WHERE cid = 9)) OR (bk NOT IN (SELECT bkr FROM bar WHERE cid = 9))); + +1 +9 +10 +12 +2 +9 +11 +13 +5 +9 +130 +140 + +statement ok +DELETE FROM foo WHERE cid = 9 AND ((ak NOT IN (SELECT akr FROM bar WHERE cid = 9)) OR (bk NOT IN (SELECT bkr FROM bar WHERE cid = 9))); + +query +select * FROM foo WHERE cid = 9 AND ((ak NOT IN (SELECT akr FROM bar WHERE cid = 9)) OR (bk NOT IN (SELECT bkr FROM bar WHERE cid = 9))); + + +statement ok +drop table foo; + +statement ok +drop table bar; ___ checkin-list mailing list -- checkin-list@monetdb.org To unsubscribe send an email to checkin-list-le...@monetdb.org
MonetDB: default - Unexport functions getBBPlogno and getBBPtran...
Changeset: c36a76cae346 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/c36a76cae346 Modified Files: clients/Tests/exports.stable.out gdk/gdk_bbp.c gdk/gdk_bbp.h gdk/gdk_private.h Branch: default Log Message: Unexport functions getBBPlogno and getBBPtransid. diffs (51 lines): diff --git a/clients/Tests/exports.stable.out b/clients/Tests/exports.stable.out --- a/clients/Tests/exports.stable.out +++ b/clients/Tests/exports.stable.out @@ -522,9 +522,7 @@ ssize_t fltToStr(str *dst, size_t *len, const flt flt_nil; gdk_return gdk_add_callback(char *name, gdk_callback_func *f, int argc, void *argv[], int interval); gdk_return gdk_remove_callback(char *, gdk_callback_func *f); -lng getBBPlogno(void); bat getBBPsize(void); -lng getBBPtransid(void); char *get_bin_path(void); int gettimeofday(struct timeval *tv, int *ignore_zone); struct tm *gmtime_r(const time_t *restrict, struct tm *restrict); diff --git a/gdk/gdk_bbp.c b/gdk/gdk_bbp.c --- a/gdk/gdk_bbp.c +++ b/gdk/gdk_bbp.c @@ -130,7 +130,7 @@ static gdk_return BBPdir_init(void); static void BBPcallbacks(void); /* two lngs of extra info in BBP.dir */ -/* these two need to be atomic because of their use in AUTHcommit() */ +/* these two are atomic because of their use in log_new() */ static ATOMIC_TYPE BBPlogno = ATOMIC_VAR_INIT(0); static ATOMIC_TYPE BBPtransid = ATOMIC_VAR_INIT(0); diff --git a/gdk/gdk_bbp.h b/gdk/gdk_bbp.h --- a/gdk/gdk_bbp.h +++ b/gdk/gdk_bbp.h @@ -59,8 +59,6 @@ #define BBPTRIM_ALL(((size_t)1) << (sizeof(size_t)*8 - 2)) /* very large positive size_t */ gdk_export bat getBBPsize(void); /* current occupied size of BBP array */ -gdk_export lng getBBPlogno(void); /* two lng of extra info in BBP.dir */ -gdk_export lng getBBPtransid(void); gdk_export unsigned BBPheader(FILE *fp, int *lineno, bat *bbpsize, lng *logno, lng *transid); gdk_export int BBPreadBBPline(FILE *fp, unsigned bbpversion, int *lineno, BAT *bn, #ifdef GDKLIBRARY_HASHASH diff --git a/gdk/gdk_private.h b/gdk/gdk_private.h --- a/gdk/gdk_private.h +++ b/gdk/gdk_private.h @@ -184,6 +184,10 @@ gdk_return GDKunlink(int farmid, const c #define GDKwarning(format, ...)\ GDKtracer_log(__FILE__, __func__, __LINE__, M_WARNING, \ GDK, NULL, format, ##__VA_ARGS__) +lng getBBPlogno(void) + __attribute__((__visibility__("hidden"))); +lng getBBPtransid(void) + __attribute__((__visibility__("hidden"))); BUN HASHappend(BAT *b, BUN i, const void *v) __attribute__((__visibility__("hidden"))); void HASHappend_locked(BAT *b, BUN i, const void *v) ___ checkin-list mailing list -- checkin-list@monetdb.org To unsubscribe send an email to checkin-list-le...@monetdb.org
MonetDB: default - Merge with Jun2023 branch.
Changeset: 3cb408452974 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/3cb408452974 Modified Files: sql/backends/monet5/rel_bin.c sql/backends/monet5/sql_statement.c sql/backends/monet5/sql_upgrades.c Branch: default Log Message: Merge with Jun2023 branch. diffs (truncated from 1001 to 300 lines): diff --git a/gdk/gdk_tm.c b/gdk/gdk_tm.c --- a/gdk/gdk_tm.c +++ b/gdk/gdk_tm.c @@ -207,6 +207,10 @@ TMsubcommit_list(bat *restrict subcommit } /* lock just prevents other global (sub-)commits */ BBPtmlock(); + if (logno < 0) + logno = getBBPlogno(); + if (transid < 0) + transid = getBBPtransid(); if (BBPsync(cnt, subcommit, sizes, logno, transid) == GDK_SUCCEED) { /* write BBP.dir (++) */ epilogue(cnt, subcommit, false); ret = GDK_SUCCEED; @@ -239,7 +243,7 @@ TMsubcommit(BAT *b) } bat_iterator_end(); - ret = TMsubcommit_list(subcommit, NULL, cnt, getBBPlogno(), getBBPtransid()); + ret = TMsubcommit_list(subcommit, NULL, cnt, -1, -1); GDKfree(subcommit); return ret; } 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 @@ -456,17 +456,7 @@ newInstructionArgs(MalBlkPtr mb, const c p = GDKzalloc(args * sizeof(p->argv[0]) + offsetof(InstrRecord, argv)); if (p == NULL) { -#if 0 - /* We are facing an hard problem. -* The upper layers of the code base assume that this routine will always produce a structure. -* Furthermore, failure to allocate such a small data structure indicates we are in serious trouble. -* The only way out is declare it a fatal error, terminate the system to avoid crashes in all kind of places. -*/ - GDKfatal(SQLSTATE(HY013) MAL_MALLOC_FAIL); - exit(1); -#else return NULL; -#endif } p->maxarg = args; p->typechk = TYPE_UNKNOWN; diff --git a/monetdb5/modules/mal/querylog.c b/monetdb5/modules/mal/querylog.c --- a/monetdb5/modules/mal/querylog.c +++ b/monetdb5/modules/mal/querylog.c @@ -256,7 +256,7 @@ static str } QLOG_init = true; - if (TMsubcommit_list(commitlist, NULL, committop, getBBPlogno(), getBBPtransid()) != GDK_SUCCEED) + if (TMsubcommit_list(commitlist, NULL, committop, -1, -1) != GDK_SUCCEED) throw(MAL, "querylog.init", GDK_EXCEPTION); return MAL_SUCCEED; } @@ -344,7 +344,7 @@ QLOGempty(void *ret) BATclear(QLOG_calls_cpuload,true); BATclear(QLOG_calls_iowait,true); - if (TMsubcommit_list(commitlist, NULL, committop, getBBPlogno(), getBBPtransid()) != GDK_SUCCEED) + if (TMsubcommit_list(commitlist, NULL, committop, -1, -1) != GDK_SUCCEED) msg = createException(MAL, "querylog.empty", GDK_EXCEPTION); MT_lock_unset(); return MAL_SUCCEED; @@ -384,7 +384,7 @@ QLOGappend(Client cntxt, MalBlkPtr mb, M throw(MAL, "querylog.append", SQLSTATE(HY013) MAL_MALLOC_FAIL); } } - if (TMsubcommit_list(commitlist, NULL, committop, getBBPlogno(), getBBPtransid()) != GDK_SUCCEED) + if (TMsubcommit_list(commitlist, NULL, committop, -1, -1) != GDK_SUCCEED) msg = createException(MAL, "querylog", GDK_EXCEPTION); MT_lock_unset(); return msg; @@ -446,7 +446,7 @@ QLOGcall(Client cntxt, MalBlkPtr mb, Mal MT_lock_unset(); throw(MAL, "querylog.call", SQLSTATE(HY013) MAL_MALLOC_FAIL); } - if (TMsubcommit_list(commitlist, NULL, committop, getBBPlogno(), getBBPtransid()) != GDK_SUCCEED) + if (TMsubcommit_list(commitlist, NULL, committop, -1, -1) != GDK_SUCCEED) msg = createException(MAL, "querylog", GDK_EXCEPTION); MT_lock_unset(); return msg; diff --git a/sql/backends/monet5/rel_bin.c b/sql/backends/monet5/rel_bin.c --- a/sql/backends/monet5/rel_bin.c +++ b/sql/backends/monet5/rel_bin.c @@ -2399,6 +2399,10 @@ rel2bin_table(backend *be, sql_rel *rel, q = pushStr(be->mb, q, mod); q = pushStr(be->mb, q, fcn); psub = stmt_direct_func(be, q); + if (psub == NULL) { + freeInstruction(q); + return NULL; + } if (ids) /* push input rowids column */ q = pushArgument(be->mb, q, ids->nr); diff --git a/sql/backends/monet5/sql_statement.c b/sql/backends/monet5/sql_statement.c --- a/sql/backends/monet5/sql_statement.c +++
MonetDB: Jun2023 - Remove dead code.
Changeset: b6b3e4d220a3 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/b6b3e4d220a3 Modified Files: monetdb5/mal/mal_instruction.c Branch: Jun2023 Log Message: Remove dead code. diffs (21 lines): 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 @@ -456,17 +456,7 @@ newInstructionArgs(MalBlkPtr mb, const c p = GDKzalloc(args * sizeof(p->argv[0]) + offsetof(InstrRecord, argv)); if (p == NULL) { -#if 0 - /* We are facing an hard problem. -* The upper layers of the code base assume that this routine will always produce a structure. -* Furthermore, failure to allocate such a small data structure indicates we are in serious trouble. -* The only way out is declare it a fatal error, terminate the system to avoid crashes in all kind of places. -*/ - GDKfatal(SQLSTATE(HY013) MAL_MALLOC_FAIL); - exit(1); -#else return NULL; -#endif } p->maxarg = args; p->typechk = TYPE_UNKNOWN; ___ checkin-list mailing list -- checkin-list@monetdb.org To unsubscribe send an email to checkin-list-le...@monetdb.org
MonetDB: Jun2023 - Delay getting logno and transid until we have...
Changeset: 4c207416995f for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/4c207416995f Modified Files: gdk/gdk_tm.c monetdb5/modules/mal/querylog.c sql/backends/monet5/sql_upgrades.c Branch: Jun2023 Log Message: Delay getting logno and transid until we have a lock. diffs (83 lines): diff --git a/gdk/gdk_tm.c b/gdk/gdk_tm.c --- a/gdk/gdk_tm.c +++ b/gdk/gdk_tm.c @@ -207,6 +207,10 @@ TMsubcommit_list(bat *restrict subcommit } /* lock just prevents other global (sub-)commits */ BBPtmlock(); + if (logno < 0) + logno = getBBPlogno(); + if (transid < 0) + transid = getBBPtransid(); if (BBPsync(cnt, subcommit, sizes, logno, transid) == GDK_SUCCEED) { /* write BBP.dir (++) */ epilogue(cnt, subcommit, false); ret = GDK_SUCCEED; @@ -239,7 +243,7 @@ TMsubcommit(BAT *b) } bat_iterator_end(); - ret = TMsubcommit_list(subcommit, NULL, cnt, getBBPlogno(), getBBPtransid()); + ret = TMsubcommit_list(subcommit, NULL, cnt, -1, -1); GDKfree(subcommit); return ret; } diff --git a/monetdb5/modules/mal/querylog.c b/monetdb5/modules/mal/querylog.c --- a/monetdb5/modules/mal/querylog.c +++ b/monetdb5/modules/mal/querylog.c @@ -256,7 +256,7 @@ static str } QLOG_init = true; - if (TMsubcommit_list(commitlist, NULL, committop, getBBPlogno(), getBBPtransid()) != GDK_SUCCEED) + if (TMsubcommit_list(commitlist, NULL, committop, -1, -1) != GDK_SUCCEED) throw(MAL, "querylog.init", GDK_EXCEPTION); return MAL_SUCCEED; } @@ -344,7 +344,7 @@ QLOGempty(void *ret) BATclear(QLOG_calls_cpuload,true); BATclear(QLOG_calls_iowait,true); - if (TMsubcommit_list(commitlist, NULL, committop, getBBPlogno(), getBBPtransid()) != GDK_SUCCEED) + if (TMsubcommit_list(commitlist, NULL, committop, -1, -1) != GDK_SUCCEED) msg = createException(MAL, "querylog.empty", GDK_EXCEPTION); MT_lock_unset(); return MAL_SUCCEED; @@ -384,7 +384,7 @@ QLOGappend(Client cntxt, MalBlkPtr mb, M throw(MAL, "querylog.append", SQLSTATE(HY013) MAL_MALLOC_FAIL); } } - if (TMsubcommit_list(commitlist, NULL, committop, getBBPlogno(), getBBPtransid()) != GDK_SUCCEED) + if (TMsubcommit_list(commitlist, NULL, committop, -1, -1) != GDK_SUCCEED) msg = createException(MAL, "querylog", GDK_EXCEPTION); MT_lock_unset(); return msg; @@ -446,7 +446,7 @@ QLOGcall(Client cntxt, MalBlkPtr mb, Mal MT_lock_unset(); throw(MAL, "querylog.call", SQLSTATE(HY013) MAL_MALLOC_FAIL); } - if (TMsubcommit_list(commitlist, NULL, committop, getBBPlogno(), getBBPtransid()) != GDK_SUCCEED) + if (TMsubcommit_list(commitlist, NULL, committop, -1, -1) != GDK_SUCCEED) msg = createException(MAL, "querylog", GDK_EXCEPTION); MT_lock_unset(); return msg; diff --git a/sql/backends/monet5/sql_upgrades.c b/sql/backends/monet5/sql_upgrades.c --- a/sql/backends/monet5/sql_upgrades.c +++ b/sql/backends/monet5/sql_upgrades.c @@ -4666,7 +4666,7 @@ sql_update_sep2022(Client c, mvc *sql, s BBPrename(u, NULL) != 0 || BBPrename(p, NULL) != 0 || BBPrename(d, NULL) != 0 || -TMsubcommit_list(authbats, NULL, 4, getBBPlogno(), getBBPtransid()) != GDK_SUCCEED)) { +TMsubcommit_list(authbats, NULL, 4, -1, -1) != GDK_SUCCEED)) { fprintf(stderr, "Committing removal of old user/password BATs failed\n"); } BBPunfix(u->batCacheid); @@ -5738,7 +5738,7 @@ sql_update_jun2023(Client c, mvc *sql, s BBPrename(rt_uri, NULL) != 0 || BATmode(rt_deleted, true) != GDK_SUCCEED || BBPrename(rt_deleted, NULL) != 0 || - TMsubcommit_list(rtauthbats, NULL, 6, getBBPlogno(), getBBPtransid()) != GDK_SUCCEED) { + TMsubcommit_list(rtauthbats, NULL, 6, -1, -1) != GDK_SUCCEED) { fprintf(stderr, "Committing removal of old remote user/password BATs failed\n"); } BBPunfix(rt_key->batCacheid); ___ checkin-list mailing list -- checkin-list@monetdb.org To unsubscribe send an email to checkin-list-le...@monetdb.org
MonetDB: Jun2023 - Either push an instruction or free it. Not b...
Changeset: 3f2a75979d98 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/3f2a75979d98 Modified Files: sql/backends/monet5/rel_bin.c sql/backends/monet5/sql_statement.c Branch: Jun2023 Log Message: Either push an instruction or free it. Not both. diffs (truncated from 897 to 300 lines): diff --git a/sql/backends/monet5/rel_bin.c b/sql/backends/monet5/rel_bin.c --- a/sql/backends/monet5/rel_bin.c +++ b/sql/backends/monet5/rel_bin.c @@ -2336,6 +2336,10 @@ rel2bin_table(backend *be, sql_rel *rel, q = pushStr(be->mb, q, mod); q = pushStr(be->mb, q, fcn); psub = stmt_direct_func(be, q); + if (psub == NULL) { + freeInstruction(q); + return NULL; + } if (ids) /* push input rowids column */ q = pushArgument(be->mb, q, ids->nr); diff --git a/sql/backends/monet5/sql_statement.c b/sql/backends/monet5/sql_statement.c --- a/sql/backends/monet5/sql_statement.c +++ b/sql/backends/monet5/sql_statement.c @@ -215,7 +215,6 @@ stmt_group(backend *be, stmt *s, stmt *g q = pushArgument(mb, q, s->nr); if (grp) q = pushArgument(mb, q, grp->nr); - pushInstruction(mb, q); if (q) { stmt *ns = stmt_create(be->mvc->sa, st_group); if (ns == NULL) { @@ -234,6 +233,7 @@ stmt_group(backend *be, stmt *s, stmt *g ns->key = 0; ns->q = q; ns->nr = getDestVar(q); + pushInstruction(mb, q); return ns; } return NULL; @@ -254,7 +254,6 @@ stmt_unique(backend *be, stmt *s) q = pushArgument(mb, q, s->nr); q = pushNil(mb, q, TYPE_bat); /* candidate list */ - pushInstruction(mb, q); if (q) { stmt *ns = stmt_create(be->mvc->sa, st_unique); if (ns == NULL) { @@ -267,6 +266,7 @@ stmt_unique(backend *be, stmt *s) ns->key = 1; ns->q = q; ns->nr = getDestVar(q); + pushInstruction(mb, q); return ns; } return NULL; @@ -332,7 +332,6 @@ stmt_var(backend *be, const char *sname, if (q == NULL) return NULL; setVarType(mb, getArg(q, 0), tt); - pushInstruction(mb, q); } else if (!declare) { char levelstr[16]; @@ -344,7 +343,6 @@ stmt_var(backend *be, const char *sname, stpcpy(stpcpy(stpcpy(stpcpy(buf, "A"), levelstr), "%"), varname); /* mangle variable name */ q = newAssignment(mb); q = pushArgumentId(mb, q, buf); - pushInstruction(mb, q); } else { int tt = t->type->localtype; char levelstr[16]; @@ -363,7 +361,6 @@ stmt_var(backend *be, const char *sname, q->argc = q->retc = 0; q = pushArgumentId(mb, q, buf); q = pushNil(mb, q, tt); - pushInstruction(mb, q); if (q == NULL) return NULL; q->retc++; @@ -383,6 +380,7 @@ stmt_var(backend *be, const char *sname, s->key = 1; s->q = q; s->nr = getDestVar(q); + pushInstruction(mb, q); return s; } return NULL; @@ -392,7 +390,6 @@ stmt * stmt_vars(backend *be, const char *varname, sql_table *t, int declare, int level) { MalBlkPtr mb = be->mb; - InstrPtr q = NULL; int *l; (void)varname; @@ -401,7 +398,6 @@ stmt_vars(backend *be, const char *varna stmt *s = stmt_create(be->mvc->sa, st_var); if (s == NULL) { - freeInstruction(q); return NULL; } @@ -430,7 +426,6 @@ stmt_varnr(backend *be, int nr, sql_subt (void) snprintf(buf, sizeof(buf), "A%d", nr); q = pushArgumentId(mb, q, buf); - pushInstruction(mb, q); if (q) { stmt *s = stmt_create(be->mvc->sa, st_var); if (s == NULL) { @@ -447,6 +442,7 @@ stmt_varnr(backend *be, int nr, sql_subt s->key = 1; s->q = q; s->nr = getDestVar(q); + pushInstruction(mb, q); return s; } return NULL; @@ -491,7 +487,6 @@ stmt_temp(backend *be, sql_subtype *t) return NULL; setVarType(mb, getArg(q, 0), newBatType(tt)); q = pushType(mb, q, tt); - pushInstruction(mb, q); if (q) { stmt *s = stmt_create(be->mvc->sa, st_temp); @@