Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does Google Cloud Spanner support default column values?

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?

like image 768
Frank Ayars Avatar asked Mar 07 '17 19:03

Frank Ayars


1 Answers

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 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.

Definitely something for the team to consider.

like image 149
Dan McGrath Avatar answered Sep 27 '22 22:09

Dan McGrath