我有一个 sql 表,这是我的列,它给出了错误。当我尝试向该表添加一条具有空 active_status 的新记录时,它会给出“非空属性引用空值或瞬态值”错误。有什么想法吗?
active_status character varying(30) NOT NULL DEFAULT 'NEW'::character varying,
编辑:我创建了一个新的简单表;
CREATE TABLE mytable
(
"MyData" character varying(30) NOT NULL DEFAULT 'NEW'::character varying,
CONSTRAINT mytable_pkey PRIMARY KEY ("MyData" )
)
WITH (
OIDS=FALSE
);
ALTER TABLE mytable
OWNER TO postgres;
当我尝试插入一个字符串时,它运行良好;
insert into mytable values('ssss');
但是当我尝试插入一个空值时,它会出错;
insert into mytable values(null);
ERROR: null value in column "MyData" violates not-null constraint
SQL state: 23502