Skip to content

Commit

Permalink
Fixed issue placing simple functions inside control exp (fixes #1128)
Browse files Browse the repository at this point in the history
  • Loading branch information
Mitko Iliev authored and pkleef committed Apr 17, 2023
1 parent 7c488ae commit a4997ed
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion binsrc/tests/suite/sqlo2.sql
Original file line number Diff line number Diff line change
Expand Up @@ -1425,7 +1425,7 @@ CREATE TABLE test_table_t1 (c1 INT, c2 BINARY(100),c3 FLOAT);
INSERT INTO test_table_t1 VALUES (100,'abcdefghij',3.0);
CREATE TABLE test_table_t2 (c1 INT, c2 VARCHAR(100));
INSERT INTO test_table_t2 VALUES (2,'abcde');
-- XXX: UPDATE test_table_t1 SET c2 = (SELECT MAX(c1) FROM test_table_t2);
UPDATE test_table_t1 SET c2 = (SELECT MAX(c1) FROM test_table_t2);
ECHO BOTH $IF $EQU $STATE OK "PASSED" "***FAILED";
SET ARGV[$LIF] $+ $ARGV[$LIF] 1;
ECHO BOTH ": #1121 STATE=" $STATE " MESSAGE=" $MESSAGE "\n";
Expand Down
10 changes: 8 additions & 2 deletions libsrc/Wi/sqloby.c
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ sqlo_is_seq_in_oby_order (sqlo_t * so, df_elt_t * dfe, df_elt_t * last_tb)
op_table_t * from_ot = so->so_this_dt;
int n_ordered = from_ot ? dk_set_length (from_ot->ot_oby_ots) : -1;
int n_in_order = 0;
for (dfe = dfe; dfe; dfe = dfe->dfe_next)
for (; dfe; dfe = dfe->dfe_next)
{
if (dfe == last_tb)
return 1;
Expand Down Expand Up @@ -794,7 +794,13 @@ sqlo_fun_ref_epilogue (sqlo_t * so, op_table_t * from_ot)
sqlo_place_exp (so, from_ot->ot_work_dfe, arg_dfe);
}
else
sqlo_place_exp (so, from_ot->ot_work_dfe, arg_dfe);
{
char prev = so->so_place_code_forr_cond;
if (DFE_VALUE_SUBQ == from_ot->ot_work_dfe->dfe_type && !group) /* simple fref */
so->so_place_code_forr_cond = 0;
sqlo_place_exp (so, from_ot->ot_work_dfe, arg_dfe);
so->so_place_code_forr_cond = prev;
}
if (fref->_.fn_ref.fn_code == AMMSC_COUNT || fref->_.fn_ref.fn_code == AMMSC_COUNTSUM)
fref_dfe->dfe_sqt.sqt_dtp = DV_LONG_INT;
else
Expand Down

0 comments on commit a4997ed

Please sign in to comment.