Changeset: 4f152b6dc3c1 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=4f152b6dc3c1 Modified Files: sql/server/sql_atom.c sql/test/BugTracker-2011/Tests/default-interval.Bug-2877.sql sql/test/pg_regress/Tests/timestamptz.sql sql/test/pg_regress/Tests/timestamptz.stable.out Branch: default Log Message:
Test fixes diffs (84 lines): diff --git a/sql/server/sql_atom.c b/sql/server/sql_atom.c --- a/sql/server/sql_atom.c +++ b/sql/server/sql_atom.c @@ -10,6 +10,7 @@ #include "sql_atom.h" #include "sql_string.h" #include "sql_decimal.h" +#include "blob.h" #include "gdk_time.h" void @@ -455,9 +456,11 @@ atom2sql(atom *a) c_delete(val); return res; } break; - case EC_BLOB: - /* TODO atom to string */ - break; + case EC_BLOB: { + char *_buf = buf; + size_t _bufsiz = BUFSIZ; + BLOBtostr(&_buf, &_bufsiz, &a->data.val.pval, true); + } break; case EC_MONTH: case EC_SEC: { lng v; @@ -503,13 +506,7 @@ atom2sql(atom *a) case 13: /* second */ break; } - if (a->tpe.digits < 4) { - sprintf(buf, LLFMT, v); - } else { - lng sec = v/1000; - lng msec = v%1000; - sprintf(buf, LLFMT "." LLFMT, sec, msec); - } + sprintf(buf, "interval '" LLFMT "' %s", ec == EC_MONTH ? v : v/1000, ec == EC_MONTH ? "month" : "second"); break; } case EC_NUM: diff --git a/sql/test/BugTracker-2011/Tests/default-interval.Bug-2877.sql b/sql/test/BugTracker-2011/Tests/default-interval.Bug-2877.sql --- a/sql/test/BugTracker-2011/Tests/default-interval.Bug-2877.sql +++ b/sql/test/BugTracker-2011/Tests/default-interval.Bug-2877.sql @@ -2,7 +2,7 @@ start transaction; create table table2877 ( i int, c1 interval hour to second default interval '1:00:00' hour to second, - c2 interval hour to second default interval '1' second + c2 interval hour to second default interval '3600' second ); insert into table2877 (i) values (1); select * from table2877; diff --git a/sql/test/pg_regress/Tests/timestamptz.sql b/sql/test/pg_regress/Tests/timestamptz.sql --- a/sql/test/pg_regress/Tests/timestamptz.sql +++ b/sql/test/pg_regress/Tests/timestamptz.sql @@ -20,7 +20,7 @@ INSERT INTO TIMESTAMPTZ_TBL VALUES (cast --INSERT INTO TIMESTAMPTZ_TBL VALUES ('yesterday'); INSERT INTO TIMESTAMPTZ_TBL VALUES (cast((select test_current_date from test_current_date) - interval '1' DAY as timestamptz)); --INSERT INTO TIMESTAMPTZ_TBL VALUES ('tomorrow'); -INSERT INTO TIMESTAMPTZ_TBL VALUES (cast((select test_current_date from test_current_date) - interval '1' DAY as timestamp)); +INSERT INTO TIMESTAMPTZ_TBL VALUES (cast((select test_current_date from test_current_date) + interval '1' DAY as timestamp)); --SELECT d1 FROM TIMESTAMPTZ_TBL; SELECT count(*) AS One FROM TIMESTAMPTZ_TBL WHERE d1 = cast((select test_current_date from test_current_date) as timestamptz); diff --git a/sql/test/pg_regress/Tests/timestamptz.stable.out b/sql/test/pg_regress/Tests/timestamptz.stable.out --- a/sql/test/pg_regress/Tests/timestamptz.stable.out +++ b/sql/test/pg_regress/Tests/timestamptz.stable.out @@ -47,13 +47,13 @@ stdout of test 'timestamptz` in director % one # name % bigint # type % 1 # length -[ 0 ] +[ 1 ] #SELECT count(*) AS One FROM TIMESTAMPTZ_TBL WHERE d1 = cast((select test_current_date from test_current_date) - interval '1' DAY as timestamp); % sys. # table_name % one # name % bigint # type % 1 # length -[ 2 ] +[ 1 ] #SELECT count(*) AS None FROM TIMESTAMPTZ_TBL WHERE d1 = cast((select test_now from test_now) as timestamptz); % . # table_name % none # name _______________________________________________ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list