Write equivalent queries for all databases as these two for MySQL and PostgreSQL :
MySQL :
select current_date() as cur_date,
current_time() as cur_time,
current_timestamp() as cur_timestamp,
utc_date() as cur_utc_date,
utc_time() as cur_utc_time,
utc_timestamp() as cur_utc_timestamp
go
select cast(current_date() as char) as cur_date,
cast(current_time() as char) as cur_time,
cast(current_timestamp() as char) as cur_timestamp,
cast(utc_date() as char) as cur_utc_date,
cast(utc_time() as char) as cur_utc_time,
cast(utc_timestamp() as char) as cur_utc_timestamp
PostgreSQL :
select current_date as cur_date,
current_time as cur_time,
current_timestamp as cur_timestamp,
current_date at time zone 'UTC' as cur_utc_date,
current_time at time zone 'UTC' as cur_utc_time,
current_timestamp at time zone 'UTC' as cur_utc_timestamp
go
select to_char(current_date, 'MM-DD-YYYY') as cur_date,
//to_char(current_time, 'HH24:MI:SS') as cur_time,
to_char(current_timestamp, 'MM-DD-YYYY HH24:MI:SS TZ') as cur_timestamp,
to_char(current_date at time zone 'UTC', 'MM-DD-YYYY') as cur_utc_date,
//to_char(current_time at time zone 'UTC', 'HH24:MI:SS') as cur_utc_time,
to_char(current_timestamp at time zone 'UTC', 'MM-DD-YYYY HH24:MI:SS') as cur_utc_timestamp
|
142 KB
|
143 KB
|
56 KB
We have listed out equivalent queries for all databases here. Please have a look
These queries work for now. I'll work with Ivan to get SAP Hana, DB2 iSeries and z/OS.
These queries work for now. I'll work with Ivan to get SAP Hana, DB2 iSeries and z/OS.
When writing the "character string" equivalent queries, make sure that the timezone information is displayed. When comparing the timestamp value with the character string value, make sure that the timezone offset is taken into account. Otherwise, the timestamp value doesn't seem to match the character string value.
Refer to Greenplum.png for details.
When writing the "character string" equivalent queries, make sure that the timezone information is displayed. When comparing the timestamp value with the character string value, make sure that the timezone offset is taken into account. Otherwise, the timestamp value doesn't seem to match the character string value.
Refer to Greenplum.png for details.
Issue #14589 |
Closed |
Fixed |
Resolved |
Completion |
No due date |
No fixed build |
No time estimate |
1 issue link |
relates to #14303
Issue #14303Evaluate changing behavior on All databases for Results Fomat of NONE on Data/Time/Timestamp to match MongoDB |
We have listed out equivalent queries for all databases here. Please have a look