diff --git a/src/backend/parser/gram.y b/src/backend/parser/gram.y index 7c0e038ebf5..eb0f61dd4b5 100644 --- a/src/backend/parser/gram.y +++ b/src/backend/parser/gram.y @@ -14539,10 +14539,20 @@ a_expr: c_expr { $$ = $1; } } | a_expr AT TIME ZONE a_expr %prec AT { - $$ = (Node *) makeFuncCall(SystemFuncName("timezone"), - list_make2($5, $1), - COERCE_SQL_SYNTAX, - @2); + if(sql_dialect == SQL_DIALECT_TSQL) + { + $$ = (Node *) makeFuncCall(list_make2(makeString("sys"), makeString("timezone")), + list_make2($5, $1), + COERCE_SQL_SYNTAX, + @2); + } + else + { + $$ = (Node *) makeFuncCall(SystemFuncName("timezone"), + list_make2($5, $1), + COERCE_SQL_SYNTAX, + @2); + } } /* * These operators must be called out explicitly in order to make use