hsqldb中时间戳大小的奇怪行为

时间:2022-08-03 17:26:46

I have sample ddl script:

我有示例ddl脚本:

CREATE TABLE PERSON
(
  ID BIGINT GENERATED BY DEFAULT AS IDENTITY NOT NULL
, FIRST_NAME VARCHAR(100) NOT NULL 
, LAST_NAME VARCHAR(100) NOT NULL 
, DATE_OF_BIRTH DATE
, GENDER VARCHAR(1) NOT NULL
, SSN VARCHAR(100)
, LAST_LOGIN TIMESTAMP
, VERSION INT DEFAULT 0 NOT NULL
);

When I open this database in db visualiser I see timestamp has size 26 . I really dont know why because I read default is 6. So I want to change it for example:

当我在db visualiser中打开这个数据库时,我看到时间戳的大小为26。我真的不知道为什么因为我读默认是6.所以我想改变它的例子:

, LAST_LOGIN TIMESTAMP(1)

now is size 21. This is really weird. Probably last integer mean size but what is the meaning of first number "2" ?

现在是21号。这真的很奇怪。可能是最后的整数平均大小,但第一个数字“2”的含义是什么?

1 个解决方案

#1


0  

What you call "size" is the subsecond precision of the timestamp, which is 6 by default. Your example of TIMESTAMP(1) defines a timestamp with subsecond precision of 1.

你称之为“大小”的是时间戳的亚秒级精度,默认为6。您的TIMESTAMP(1)示例定义了亚秒级精度为1的时间戳。

The number you see in DB Visualiser is the display size of the TIMESTAMP column.

您在DB Visualiser中看到的数字是TIMESTAMP列的显示大小。

TIMESTAMP(1), such as '2013-06-19 01:01:01.1', is always respresented using 21 characters. Timestamps defined as TIMESTAMP or TIMESTAMP(6) are displayed with five more digits at the end.

TIMESTAMP(1),例如'2013-06-19 01:01:01.1',始终使用21个字符进行表示。定义为TIMESTAMP或TIMESTAMP(6)的时间戳在末尾显示五位数。

#1


0  

What you call "size" is the subsecond precision of the timestamp, which is 6 by default. Your example of TIMESTAMP(1) defines a timestamp with subsecond precision of 1.

你称之为“大小”的是时间戳的亚秒级精度,默认为6。您的TIMESTAMP(1)示例定义了亚秒级精度为1的时间戳。

The number you see in DB Visualiser is the display size of the TIMESTAMP column.

您在DB Visualiser中看到的数字是TIMESTAMP列的显示大小。

TIMESTAMP(1), such as '2013-06-19 01:01:01.1', is always respresented using 21 characters. Timestamps defined as TIMESTAMP or TIMESTAMP(6) are displayed with five more digits at the end.

TIMESTAMP(1),例如'2013-06-19 01:01:01.1',始终使用21个字符进行表示。定义为TIMESTAMP或TIMESTAMP(6)的时间戳在末尾显示五位数。