postgresql 自增主键

CREATE SEQUENCE your_seq;
CREATE TABLE foo(
  id int default nextval('your_seq'::regclass),
  other_column TEXT
);
INSERT INTO foo(other_column) VALUES ('bar') RETURNING *;

 

posted @ 2022-05-26 14:15  正怒月神  阅读(92)  评论(0编辑  收藏  举报