Changeset: 3f2e70112dfd for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/3f2e70112dfd
Modified Files:
sql/server/sql_parser.y
sql/test/odbc-escape-sequences/Tests/time-date-interval-functions.test
Branch: escape-sequences
Log Message:
timestampdiff partial case
diffs (38 lines):
diff --git a/sql/server/sql_parser.y b/sql/server/sql_parser.y
--- a/sql/server/sql_parser.y
+++ b/sql/server/sql_parser.y
@@ -6485,6 +6485,22 @@ odbc_datetime_func:
append_symbol(l, $7);
$$ = _symbol_create_list( SQL_BINOP, l );
}
+ | TIMESTAMPDIFF '(' odbc_tsi_qualifier ',' intval ',' search_condition ')'
+ { dlist *l = L();
+ // TODO sql_diff or custom func ?
+ append_list( l, append_string(L(), sa_strdup(SA, "sql_sub")));
+ append_int(l, FALSE); /* ignore distinct */
+ sql_subtype t;
+ lng i = 0;
+ if (process_odbc_interval(m, $3, $5, &t, &i) < 0) {
+ yyerror(m, "incorrect interval");
+ $$ = NULL;
+ YYABORT;
+ }
+ append_symbol(l, $7);
+ append_symbol(l, _newAtomNode(atom_int(SA, &t, i)));
+ $$ = _symbol_create_list( SQL_BINOP, l );
+ }
;
diff --git
a/sql/test/odbc-escape-sequences/Tests/time-date-interval-functions.test
b/sql/test/odbc-escape-sequences/Tests/time-date-interval-functions.test
--- a/sql/test/odbc-escape-sequences/Tests/time-date-interval-functions.test
+++ b/sql/test/odbc-escape-sequences/Tests/time-date-interval-functions.test
@@ -106,3 +106,8 @@ query T rowsort
select { fn timestampadd(SQL_TSI_HOUR, 1, timestamp'2022-11-14 12:12:12') }
----
2022-11-14 13:12:12
+
+query T rowsort
+select { fn timestampdiff(SQL_TSI_HOUR, 1, timestamp'2022-11-14 12:12:12') }
+----
+2022-11-14 11:12:12
_______________________________________________
checkin-list mailing list -- [email protected]
To unsubscribe send an email to [email protected]