[ 
https://issues.apache.org/jira/browse/IGNITE-17376?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Konstantin Orlov updated IGNITE-17376:
--------------------------------------
    Description: 
Currently default value is not supported for columns with type {{TIMESTAMP WITH 
LOCAL TIME ZONE}}, because behaviour is not clear:
* if default value literal MUST contain time zone, then sql parser should be 
extended to provide ability to specify timestamp with time zone literal
* if default value literal MAY NOT contain time zone, then some research is 
needed. Consider the following case:

{code:java}
CREATE TABLE t (id INT PRIMARY KEY, val TIMESTAMP WITH LOCAL TIME ZONE DEFAULT 
TIMESTAMP '2021-01-01 01:01:01')
{code}

Which timezone should be chosen for converting this literal to UTC: timezone of 
the server or timezone of the client who create this table? Should the inserted 
values be the same in case the user inserts values explicitly or implicitly 
(though DEFAULT) like that:

{code:java}
INSERT INTO t (id) VALUES (0);
                       VS
INSERT INTO t (id, val) VALUES (0, DEFAULT);
                       VS
INSERT INTO t (id, val) VALUES (0, TIMESTAMP '2021-01-01 01:01:01');
{code}

Let's provide some research on this topic and chose the proper way to address 
the issue.



  was:
Currently default value is not supported for columns with type {{TIMESTAMP WITH 
LOCAL TIME ZONE}}, because behaviour is not clear:
* if default value literal MUST contain time zone, then sql parser should be 
extended to provide ability to specify timestamp with time zone literal
* if default value literal MIGHT NOT contain time zone, then some research is 
needed. Consider the following case:

{code:java}
CREATE TABLE t (id INT PRIMARY KEY, val TIMESTAMP WITH LOCAL TIME ZONE DEFAULT 
TIMESTAMP '2021-01-01 01:01:01')
{code}

Which timezone should be chosen for converting this literal to UTC: timezone of 
the server or timezone of the client who create this table? Should the inserted 
values be the same in case the user inserts values explicitly or implicitly 
(though DEFAULT) like that:

{code:java}
INSERT INTO t (id) VALUES (0);
                       VS
INSERT INTO t (id, val) VALUES (0, DEFAULT);
                       VS
INSERT INTO t (id, val) VALUES (0, TIMESTAMP '2021-01-01 01:01:01');
{code}

Let's provide some research on this topic and chose the proper way to address 
the issue.




> Sql. Investigate of support default value for TIMESTAMP WITH LOCAL TIME ZONE 
> type 
> ----------------------------------------------------------------------------------
>
>                 Key: IGNITE-17376
>                 URL: https://issues.apache.org/jira/browse/IGNITE-17376
>             Project: Ignite
>          Issue Type: Bug
>          Components: sql
>            Reporter: Konstantin Orlov
>            Priority: Major
>              Labels: ignite-3, tech-debt
>
> Currently default value is not supported for columns with type {{TIMESTAMP 
> WITH LOCAL TIME ZONE}}, because behaviour is not clear:
> * if default value literal MUST contain time zone, then sql parser should be 
> extended to provide ability to specify timestamp with time zone literal
> * if default value literal MAY NOT contain time zone, then some research is 
> needed. Consider the following case:
> {code:java}
> CREATE TABLE t (id INT PRIMARY KEY, val TIMESTAMP WITH LOCAL TIME ZONE 
> DEFAULT TIMESTAMP '2021-01-01 01:01:01')
> {code}
> Which timezone should be chosen for converting this literal to UTC: timezone 
> of the server or timezone of the client who create this table? Should the 
> inserted values be the same in case the user inserts values explicitly or 
> implicitly (though DEFAULT) like that:
> {code:java}
> INSERT INTO t (id) VALUES (0);
>                        VS
> INSERT INTO t (id, val) VALUES (0, DEFAULT);
>                        VS
> INSERT INTO t (id, val) VALUES (0, TIMESTAMP '2021-01-01 01:01:01');
> {code}
> Let's provide some research on this topic and chose the proper way to address 
> the issue.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to