Changeset: d73ff30c1afe for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=d73ff30c1afe Added Files: sql/test/BugTracker-2020/Tests/round.Bug-6955.sql sql/test/BugTracker-2020/Tests/round.Bug-6955.stable.err sql/test/BugTracker-2020/Tests/round.Bug-6955.stable.out Modified Files: sql/server/rel_select.c sql/test/BugTracker-2020/Tests/All Branch: Jun2020 Log Message:
add test for bug 6955 fixed bug 6955, ie don't convert input type for inout functions diffs (126 lines): diff --git a/sql/server/rel_select.c b/sql/server/rel_select.c --- a/sql/server/rel_select.c +++ b/sql/server/rel_select.c @@ -9,8 +9,6 @@ #include "monetdb_config.h" #include "rel_select.h" #include "sql_tokens.h" -#include "sql_semantic.h" /* TODO this dependency should be removed, move - the dependent code into sql_mvc */ #include "sql_privileges.h" #include "sql_env.h" #include "rel_rel.h" @@ -3072,7 +3070,8 @@ rel_binop_(mvc *sql, sql_rel *rel, sql_e if (!check_card(card,f)) continue; - l = exp_check_type(sql, &a->type, rel, l, type_equal); + if (f->func->fix_scale != INOUT) + l = exp_check_type(sql, &a->type, rel, l, type_equal); a = m->next->data; r = exp_check_type(sql, &a->type, rel, r, type_equal); if (l && r) @@ -3128,7 +3127,8 @@ rel_binop_(mvc *sql, sql_rel *rel, sql_e node *m = f->func->ops->h; sql_arg *a = m->data; - l = exp_check_type(sql, &a->type, rel, l, type_equal); + if (f->func->fix_scale != INOUT) + l = exp_check_type(sql, &a->type, rel, l, type_equal); a = m->next->data; r = exp_check_type(sql, &a->type, rel, r, type_equal); if (l && r) diff --git a/sql/test/BugTracker-2020/Tests/All b/sql/test/BugTracker-2020/Tests/All --- a/sql/test/BugTracker-2020/Tests/All +++ b/sql/test/BugTracker-2020/Tests/All @@ -18,3 +18,4 @@ tpch-cube.Bug-6938 HAVE_PYMONETDB?remote-table-like.Bug-6841 KNOWNFAIL?copy-empty-blob.Bug-6948 values-like-join.Bug-6954 +round.Bug-6955 diff --git a/sql/test/BugTracker-2020/Tests/round.Bug-6955.sql b/sql/test/BugTracker-2020/Tests/round.Bug-6955.sql new file mode 100644 --- /dev/null +++ b/sql/test/BugTracker-2020/Tests/round.Bug-6955.sql @@ -0,0 +1,13 @@ +CREATE TABLE decimals(d DECIMAL(4,1), prec INTEGER); +INSERT INTO decimals VALUES ('999.9', 0); +SELECT ROUND(d, prec) FROM decimals; +-- expected: 1000, actual: 100 +SELECT ROUND(CAST(999.9 AS DECIMAL(4,1)), 0); +-- correct result: 1000 +SELECT ROUND(d, 0) FROM decimals; +-- correct result: 1000.0 +SELECT ROUND(d, 0.1) FROM decimals; +-- expected: error or 1000.0, got 100.0 +SELECT ROUND(CAST(999.9 AS DECIMAL(4,1)), 0.1); +-- same result: got 100.0 +drop table decimals; diff --git a/sql/test/BugTracker-2020/Tests/round.Bug-6955.stable.err b/sql/test/BugTracker-2020/Tests/round.Bug-6955.stable.err new file mode 100644 --- /dev/null +++ b/sql/test/BugTracker-2020/Tests/round.Bug-6955.stable.err @@ -0,0 +1,12 @@ +stderr of test 'round.Bug-6955` in directory 'sql/test/BugTracker-2020` itself: + + +# 13:22:40 > +# 13:22:40 > "mclient" "-lsql" "-ftest" "-tnone" "-Eutf-8" "-i" "-e" "--host=/var/tmp/mtest-761252" "--port=39464" +# 13:22:40 > + + +# 13:22:40 > +# 13:22:40 > "Done." +# 13:22:40 > + diff --git a/sql/test/BugTracker-2020/Tests/round.Bug-6955.stable.out b/sql/test/BugTracker-2020/Tests/round.Bug-6955.stable.out new file mode 100644 --- /dev/null +++ b/sql/test/BugTracker-2020/Tests/round.Bug-6955.stable.out @@ -0,0 +1,46 @@ +stdout of test 'round.Bug-6955` in directory 'sql/test/BugTracker-2020` itself: + + +# 13:22:40 > +# 13:22:40 > "mclient" "-lsql" "-ftest" "-tnone" "-Eutf-8" "-i" "-e" "--host=/var/tmp/mtest-761252" "--port=39464" +# 13:22:40 > + +#CREATE TABLE decimals(d DECIMAL(4,1), prec INTEGER); +#INSERT INTO decimals VALUES ('999.9', 0); +[ 1 ] +#SELECT ROUND(d, prec) FROM decimals; +% sys.%1 # table_name +% %1 # name +% decimal # type +% 6 # length +[ 1000.0 ] +#SELECT ROUND(CAST(999.9 AS DECIMAL(4,1)), 0); +% .%2 # table_name +% %2 # name +% decimal # type +% 6 # length +[ 1000.0 ] +#SELECT ROUND(d, 0) FROM decimals; +% sys.%1 # table_name +% %1 # name +% decimal # type +% 6 # length +[ 1000.0 ] +#SELECT ROUND(d, 0.1) FROM decimals; +% sys.%1 # table_name +% %1 # name +% decimal # type +% 6 # length +[ 1000.0 ] +#SELECT ROUND(CAST(999.9 AS DECIMAL(4,1)), 0.1); +% .%2 # table_name +% %2 # name +% decimal # type +% 6 # length +[ 1000.0 ] +#drop table decimals; + +# 13:22:40 > +# 13:22:40 > "Done." +# 13:22:40 > + _______________________________________________ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list