org.springframework.jdbc.BadSqlGrammarException: Error selecting key or setting result to parameter object. Cause: org.postgresql.util.PSQLException: ERROR: relation "skema.table_id_seq" does not exist Position: 24
; bad SQL grammar []; nested exception is org.postgresql.util.PSQLException: ERROR: relation "skema.table_id_seq" does not exist Position: 24
报错原因:
table表中id是自增的,但自增序列名称叫table_id_seq1,
解决办法:
Postgre数据库创建和修改序列:
从最大id的下一条开始自增,
CREATE SEQUENCE IF NOT EXISTS table_id_seq start with 100;
ALTER TABLE skema.table ALTER COLUMN id SET DEFAULT nextval('skema.table_id_seq'::regclass);