雪花没有为时间戳选择默认值

时间:2021-03-26 13:16:01

标签: database snowflake-cloud-data-platform snowflake-schema

我在 TIMESTAMP_TZ(9) 类型的雪花中有一列,我已将其默认值设置为 CURRENT_TIMESTAMP()。

但仍然在所有行中,我将此列的值为空。

enter image description here

为什么没有反映默认值并给出空值?

1 个答案:

答案 0 :(得分:2)

您确定不是手动插入 NULL 吗?

这对我有用:

create or replace table testX(id integer autoincrement, text string, time timestamp_tz(9) default current_timestamp());
insert into testX (text) values ('test message');

我明白了:

enter image description here

然后我插入一个 NULL 值:

insert into testX (time) values (NULL);

现在我明白了:

enter image description here

表定义与您的完全一样:

describe table testX;

我明白了:

enter image description here