Search code examples
hsqldb

HSQLDB - ON UPDATE CURRENT_TIMESTAMP with TIMESTAMP column


With this table definition:

CREATE TABLE T1 (C1 TIMESTAMP DEFAULT NOW() ON UPDATE CURRENT_TIMESTAMP NOT 
NULL);

when a row is updated C1 is set to the current UTC timestamp.

This is what I want however I was wondering if this is also the intended behavior of HSQLDB since CURRENT_TIMESTAMP returns a value of TIMESTAMP WITH TIME ZONE type.


Solution

  • HSQLDB implements the ISO SQL:2016 Standard. The LOCALTIMESTAMP and CURRENT_TIMESTAMP are Standard functions and return TIMESTAMP values WITHOUT or WITH TIME ZONE respectively. The Standard mandates silent two-way conversion between TIMESTAMP values with or without time zone. Therefore the value returned from CURRENT_TIMEZONE is converted to a value without time zone. This is done by discarding the time zone information.