postgresql设置主键自增
法一:
CREATE TABLE banners
(
id SERIAL primary key ,
name character varying,
)
法二:
CREATE SEQUENCE banners_id_seq START WITH 1 INCREMENT BY 1 NO MINVALUE NO MAXVALUE CACHE 1; alter table banners alter column id setdefault nextval('banners_id_seq');