postgresql字段默认设置当前时间

CREATE TABLE "public"."my_pg_table" (
	"id" BIGSERIAL NOT NULL,
	"content" VARCHAR NULL DEFAULT NULL,
	"yesterday" DATE NOT NULL DEFAULT DATE(TIMEZONE('UTC-8'::TEXT, NOW())) - INTEGER '1',
	"ts" TIMESTAMP NOT NULL DEFAULT TIMEZONE('UTC-8'::TEXT, NOW()::TIMESTAMP(0) WITHOUT TIME ZONE),
	PRIMARY KEY ("id")
)
;
posted @ 2022-06-27 09:46  CrossPython  阅读(4846)  评论(0编辑  收藏  举报