设置字段的数据类型为serial

create table test_searial(id serial,id2 serial2);

-- 查看自增的设置:
SELECT c.relname FROM pg_class c WHERE c.relkind = 'S';

``

相关文章: