解决Pg新增数据主键冲突

更新索引至最大值:select setval('"demo".test_id_seq', (SELECT MAX("id") FROM demo.test));

查询下一个序列值:select nextval('"demo".test_id_seq');

猜你喜欢

转载自www.cnblogs.com/az4215/p/12468846.html