且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

在postgresql中为表创建指定字段的默认值

更新时间:2022-06-09 00:03:07

p> As postgresql文档声明

As postgresql documentation states


DEFAULT子句为其列定义出现的列分配一个默认数据值。该值是任何无变量表达式(子查询和对当前表中其他列的交叉引用不允许)。默认表达式的数据类型必须与列的数据类型匹配。

The DEFAULT clause assigns a default data value for the column whose column definition it appears within. The value is any variable-free expression (subqueries and cross-references to other columns in the current table are not allowed). The data type of the default expression must match the data type of the column.

规则( http://www.postgresql.org/docs/9.4/static /rules-update.html