Hi Ilya,

thnx for replay, I think that Ignite CURRENT_TIMESTAMP() is NOT TIMESTAMP
WITH TIME ZONE.

Below it test with inserting CURRENT_TIMESTAMP in two tables, one with data
type TIMESTAMP and second with TIMESTAMP WITH TIME ZONE.

First of all, 
in Ignite documentation I can't find that CURRENT_TIMESTAMP() returns
TIMESTAMP WITH TIME ZONE.

In H2 documentation we can see that H2 have two data types:
TIMESTAMP and TIMESTAMP WITH TIME ZONE 
http://www.h2database.com/html/datatypes.html#timestamp_with_time_zone_type

In H2 CURRENT_TIMESTAMP returns the current timestamp with time zone.

I think that in Ignite CURRENT_TIMESTAMP is ONLY CURRENT_TIMESTAMP without
TIME ZONE.

https://apacheignite-sql.readme.io/docs/current_timestamp


0: jdbc:ignite:thin://192.168.50.95/> SELECT CURRENT_TIMESTAMP();
+--------------------------------+
|      CURRENT_TIMESTAMP()       |
+--------------------------------+
| 2020-04-27 13:59:39.814        |
+--------------------------------+

In first table insert of CURRENT_TIMESTAMP() in data type timestamp is OK.

CREATE TABLE TEST1
(
        id                              varchar(10),
        time1                   timestamp,
        PRIMARY KEY (id)
) WITH "CACHE_NAME=TEST1, DATA_REGION=PersistDataRegion,
TEMPLATE=REPLICATED, BACKUPS=1";

0: jdbc:ignite:thin://192.168.50.95/> INSERT INTO TEST1 (id, time1) values
('a', CURRENT_TIMESTAMP());
1 row affected (0.051 seconds)


In second table insert of CURRENT_TIMESTAMP() in data type timestamp with
time zone is NOT OK.

CREATE TABLE TEST2
(
        id                              varchar(10),
        time1                   timestamp with time zone,
        PRIMARY KEY (id)
) WITH "CACHE_NAME


0: jdbc:ignite:thin://192.168.50.95/> INSERT INTO TEST2 (id, time1) values
('a', CURRENT_TIMESTAMP());
Error: class org.apache.ignite.IgniteException: Failed to execute SQL query.
Hexadecimal string with odd number of characters: "2020-04-27 13:59:00.599";
SQL statement:
SELECT
TABLE.ID,
TABLE.TIME1
FROM TABLE(ID VARCHAR(10)=('a',), TIME1 OTHER=(CURRENT_TIMESTAMP(),))
[90003-197] (state=50000,code=1)
java.sql.SQLException: class org.apache.ignite.IgniteException: Failed to
execute SQL query. Hexadecimal string with odd number of characters:
"2020-04-27 13:59:00.599"; SQL statement:
SELECT
TABLE.ID,
TABLE.TIME1
FROM TABLE(ID VARCHAR(10)=('a',), TIME1 OTHER=(CURRENT_TIMESTAMP(),))
[90003-197]
        at
org.apache.ignite.internal.jdbc.thin.JdbcThinConnection.sendRequest(JdbcThinConnection.java:750)
        at
org.apache.ignite.internal.jdbc.thin.JdbcThinStatement.execute0(JdbcThinStatement.java:212)
        at
org.apache.ignite.internal.jdbc.thin.JdbcThinStatement.execute(JdbcThinStatement.java:475)
        at sqlline.Commands.execute(Commands.java:823)
        at sqlline.Commands.sql(Commands.java:733)
        at sqlline.SqlLine.dispatch(SqlLine.java:795)
        at sqlline.SqlLine.begin(SqlLine.java:668)
        at sqlline.SqlLine.start(SqlLine.java:373)
        at sqlline.SqlLine.main(SqlLine.java:265)


Please, do you know why I can't insert CURRENT_TIMESTAMP() in data type
timestamp with time zone.


Best regards




--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/

Reply via email to