Changeset: 3b173df1aa96 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=3b173df1aa96 Modified Files: sql/server/rel_psm.c sql/test/subquery/Tests/subquery4.sql sql/test/subquery/Tests/subquery4.stable.out Branch: Jun2020 Log Message:
Added labels if expressions don't have a name diffs (55 lines): diff --git a/sql/server/rel_psm.c b/sql/server/rel_psm.c --- a/sql/server/rel_psm.c +++ b/sql/server/rel_psm.c @@ -129,6 +129,8 @@ psm_set_exp(sql_query *query, dnode *n) } level = stack_find_frame(sql, vname); + if (!exp_name(v)) + exp_label(sql->sa, v, ++sql->label); v = exp_ref(sql->sa, v); if (!(v = rel_check_type(sql, tpe, rel_val, v, type_cast))) return NULL; @@ -531,6 +533,8 @@ rel_select_into( sql_query *query, symbo return sql_error(sql, 02, SQLSTATE(42000) "SELECT INTO: variable '%s' unknown", nme); tpe = stack_find_type(sql, nme); level = stack_find_frame(sql, nme); + if (!exp_name(v)) + exp_label(sql->sa, v, ++sql->label); v = exp_ref(sql->sa, v); if (!(v = rel_check_type(sql, tpe, r, v, type_equal))) return NULL; diff --git a/sql/test/subquery/Tests/subquery4.sql b/sql/test/subquery/Tests/subquery4.sql --- a/sql/test/subquery/Tests/subquery4.sql +++ b/sql/test/subquery/Tests/subquery4.sql @@ -197,6 +197,10 @@ SELECT (SELECT i) INTO myvar FROM intege DECLARE ovar INT; SET ovar = (SELECT (SELECT i) FROM integers); --error, one row max +DECLARE abc,def INT; +SET (abc, def) = (SELECT 1, 2); +SELECT abc, def; + UPDATE another_T SET col1 = MIN(col1); --error, aggregates not allowed in update set clause UPDATE another_T SET col2 = 1 WHERE col1 = SUM(col2); --error, aggregates not allowed in update set clause UPDATE another_T SET col3 = (SELECT MAX(col5)); --error, aggregates not allowed in update set clause diff --git a/sql/test/subquery/Tests/subquery4.stable.out b/sql/test/subquery/Tests/subquery4.stable.out --- a/sql/test/subquery/Tests/subquery4.stable.out +++ b/sql/test/subquery/Tests/subquery4.stable.out @@ -300,6 +300,16 @@ stdout of test 'subquery4` in directory [ 3, 2 ] [ 3, 3 ] [ 3, NULL ] +#DECLARE myvar INT; +#DECLARE ovar INT; +#DECLARE abc,def INT; +#SET (abc, def) = (SELECT 1, 2); +#SELECT abc, def; +% ., . # table_name +% single_value, single_value # name +% int, int # type +% 1, 1 # length +[ 1, 2 ] #UPDATE another_T SET col4 = (SELECT SUM(col4 + ColID) FROM tbl_ProductSales); --4 rows affected [ 4 ] #SELECT col4 FROM another_T; _______________________________________________ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list