Changeset: 998089b7cdd7 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=998089b7cdd7
Modified Files:
monetdb5/modules/kernel/calc.mx
sql/ChangeLog.Aug2011
sql/common/sql_types.c
Branch: Aug2011
Log Message:
sign() returns an int, both in MAL (calc.sign) and SQL.
With an unfixed server, try
select sign(1);
select sign(1.0);
select sign(1.00);
and be amazed with the results.
diffs (38 lines):
diff --git a/monetdb5/modules/kernel/calc.mx b/monetdb5/modules/kernel/calc.mx
--- a/monetdb5/modules/kernel/calc.mx
+++ b/monetdb5/modules/kernel/calc.mx
@@ -341,7 +341,7 @@ comment "Concatenate two strings";
comment "negative value";
command sizeof(x:@1):int
address CALCsizeof@1;
- command sign(x:@1) :@1
+ command sign(x:@1) :int
address CALCunary@1SIGN
comment "Returns +1, 0, -1 based on the sign of the given
expression";
@= unary_ops
diff --git a/sql/ChangeLog.Aug2011 b/sql/ChangeLog.Aug2011
--- a/sql/ChangeLog.Aug2011
+++ b/sql/ChangeLog.Aug2011
@@ -1,6 +1,10 @@
# ChangeLog file for sql
# This file is updated with Maddlog
+* Wed Nov 2 2011 Sjoerd Mullender <[email protected]>
+- Changed a bug where the sign() function returned the same type as its
+ argument instead of always an INTEGER.
+
* Wed Oct 26 2011 Fabian Groffen <[email protected]>
- Added a fix for bug #2834, which caused weird (failing) behaviour
with PreparedStatements.
diff --git a/sql/common/sql_types.c b/sql/common/sql_types.c
--- a/sql/common/sql_types.c
+++ b/sql/common/sql_types.c
@@ -1327,7 +1327,7 @@ sqltypeinit(void)
sql_create_func("sql_neg", "calc", "-", *t, NULL, *t, INOUT);
sql_create_func("sql_pos", "calc", "+", *t, NULL, *t, INOUT);
sql_create_func("abs", "calc", "abs", *t, NULL, *t, SCALE_FIX);
- sql_create_func("sign", "calc", "sign", *t, NULL, *t,
SCALE_FIX);
+ sql_create_func("sign", "calc", "sign", *t, NULL, INT,
SCALE_NONE);
/* scale fixing for all numbers */
sql_create_func("scale_up", "calc", "*", *t, lt->type, *t,
SCALE_NONE);
sql_create_func("scale_down", "sql", "dec_round", *t, lt->type,
*t, SCALE_NONE);
_______________________________________________
Checkin-list mailing list
[email protected]
http://mail.monetdb.org/mailman/listinfo/checkin-list