qid
这就是PK,
question
geo_type
user_input
active
所以我需要能够做到这一点
insert into sip_questions (question,geo_type,user_input,active) values('noury','octagon',TRUE,TRUE)
但这给了我这个错误
ERROR: duplicate key value violates unique constraint "s_questions_pkey"
DETAIL: Key (qid)=(1) already exists.
********** Error **********
ERROR: duplicate key value violates unique constraint "s_questions_pkey"
SQL state: 23505
Detail: Key (qid)=(1) already exists.
这是桌子
CREATE TABLE public.sip_questions
(
qid integer NOT NULL DEFAULT nextval('s_questions_qid_seq'::regclass),
question character varying(200),
geo_type character varying(10),
user_input boolean,
active boolean,
CONSTRAINT s_questions_pkey PRIMARY KEY (qid)
)
WITH (
OIDS=FALSE
);
ALTER TABLE public.sip_questions
OWNER TO postgres;
我知道如何在这样一张新鲜的桌子上做这件事
ALTER TABLE table ADD COLUMN id SERIAL PRIMARY KEY;