阅读背景:

Google Cloud Spanner是否支持默认列值?

来源:互联网 

Having the capability to compute a UTC timestamp as the default value for a column is a handy feature of most popular database solutions. Does Google Cloud Spanner support this? If not, is this a possible roadmap item?

能够计算UTC时间戳作为列的默认值是大多数流行数据库解决方案的便利功能。 Google Cloud Spanner是否支持此功能?如果没有,这是一个可能的路线图项目吗?

1 个解决方案

#1


3  

Cloud Spanner doesn't actually allow any default value to be specified regardless of type. This means the implicit default is Null, or Error, depending on whether to column was specified with NOT NULL

Cloud Spanner实际上不允许指定任何默认值,无论类型如何。这意味着隐式默认值为Null或Error,具体取决于是否使用NOT NULL指定了列

Cloud Spanner internally stores a 'timestamp' of when a row was committed, but it doesn't expose this directly. It also doesn't behave like a default value (set once), so unfortunately the answer to your question is currently no.

Cloud Spanner在内部存储提交行的“时间戳”,但不直接公开。它也不像默认值(设置一次),所以不幸的是你的问题的答案目前是否定的。

Definitely something for the team to consider.

绝对是团队需要考虑的事情。


分享到: