Skip to content

Commit

Permalink
Merge with Dec2023 branch.
Browse files Browse the repository at this point in the history
  • Loading branch information
sjoerdmullender committed May 2, 2024
2 parents c4b466c + 369e484 commit 39e8877
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
2 changes: 2 additions & 0 deletions sql/server/rel_optimize_proj.c
Expand Up @@ -1781,6 +1781,8 @@ rel_groupby_cse(visitor *v, sql_rel *rel)
sql_exp *e1_in_exps = (e1->l && e1->alias.rname == e1->l && e1->alias.name == e1->r) ?
exps_bind_column2(rel->exps, e1->l, e1->r, NULL) :
exps_bind_column(rel->exps, e1->alias.name, NULL, NULL, 0);
if (!e1_in_exps)
continue;
assert(e1_in_exps);

/* write e2 as an e1 alias since the expressions are the same */
Expand Down
2 changes: 2 additions & 0 deletions sql/server/rel_select.c
Expand Up @@ -3299,6 +3299,8 @@ rel_nop(sql_query *query, sql_rel **rel, symbol *se, int fs, exp_kind ek)
if (!sname && strcmp(fname, "field") == 0) { /* map into join */
if (err)
return NULL;
if (list_length(exps) < 2)
return sql_error(sql, 02, SQLSTATE(42000) "Field function called with not enough arguments");
sql_exp *le = exps->h->data;
set_freevar(le, 1);
list_remove_data(exps, NULL, le);
Expand Down
5 changes: 4 additions & 1 deletion sql/test/BugTracker-2024/Tests/field-arg-error-Bug-7506.test
@@ -1,2 +1,5 @@
statement error
statement error 42000!SELECT: identifier 'x' unknown
SELECT FIELD(x, '', '', '', '', '', '', '', '', '', '', '', '', '')

statement error 42000!Field function called with not enough arguments
SELECT FIELD('fieldID99999999999999999999999999999999999999999999999999999999999999999999999')

0 comments on commit 39e8877

Please sign in to comment.