雪花没有选择时间戳的默认值
Snowflake not picking default value for timestamp
我在 TIMESTAMP_TZ(9) 类型的雪花中有一列,我已将其默认值设置为
CURRENT_TIMESTAMP().
但在所有行中,我都将此列的值为空。
为什么没有反映默认值并给出空值?
您确定您没有手动插入 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');
我得到:
然后我插入一个NULL值:
insert into testX (time) values (NULL);
现在我看到了:
Table 定义看起来和你的完全一样:
describe table testX;
我明白了:
我在 TIMESTAMP_TZ(9) 类型的雪花中有一列,我已将其默认值设置为 CURRENT_TIMESTAMP().
但在所有行中,我都将此列的值为空。
为什么没有反映默认值并给出空值?
您确定您没有手动插入 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');
我得到:
然后我插入一个NULL值:
insert into testX (time) values (NULL);
现在我看到了:
Table 定义看起来和你的完全一样:
describe table testX;
我明白了: