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

Specifying default value for a field for table creation in postgresql

以下是我的table设计:

CREATE TABLE "x"."y"(
    "z" timestamp NOT NULL,
    "a" Timestamp NOT NULL DEFAULT z + 18 months,
)
WITH (OIDS=FALSE)
;

如何指定'a'的默认值?

我可以在 table 创建时指定吗?

正如 postgresql 文档所述

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)