org.jooq.exception.DataAccessException: SQL [insert into secrets (name, createdat, updatedat, description, createdby, updatedby, type, options) values (?, cast(? as timestamp), cast(? as timestamp), ?, ?, ?, ?, ?) returning secrets.id]; duplicate key value violates unique constraint "secrets_pkey"


Solutions on the web

Solution icon of github
via GitHub by sureshg
, 9 months ago
SQL [insert into secrets (name, createdat, updatedat, description, createdby, updatedby, type, options) values (?, cast(? as timestamp), cast(? as timestamp), ?, ?, ?, ?, ?) returning secrets.id]; duplicate key value violates unique constraint "secrets_pkey"

Stack trace

org.jooq.exception.DataAccessException: SQL [insert into secrets (name, createdat, updatedat, description, createdby, updatedby, type, options) values (?, cast(? as timestamp), cast(? as timestamp), ?, ?, ?, ?, ?) returning secrets.id]; duplicate key value violates unique constraint "secrets_pkey"
	at com.impossibl.postgres.jdbc.ErrorUtils.makeSQLException(ErrorUtils.java:154)
	at com.impossibl.postgres.jdbc.ErrorUtils.makeSQLException(ErrorUtils.java:136)
	at com.impossibl.postgres.jdbc.PGConnectionImpl.execute(PGConnectionImpl.java:438)
	at com.impossibl.postgres.jdbc.PGStatement.executeStatement(PGStatement.java:375)
	at com.impossibl.postgres.jdbc.PGPreparedStatement.execute(PGPreparedStatement.java:261)
	at com.impossibl.postgres.jdbc.PGPreparedStatement.executeQuery(PGPreparedStatement.java:277)
	at com.impossibl.postgres.jdbc.PGPreparedStatement.executeQuery(PGPreparedStatement.java:92)
	at org.jooq.tools.jdbc.DefaultPreparedStatement.executeQuery(DefaultPreparedStatement.java:83)
	at org.jooq.impl.AbstractDMLQuery.execute(AbstractDMLQuery.java:376)
	at org.jooq.impl.AbstractQuery.execute(AbstractQuery.java:342)
	at org.jooq.impl.TableRecordImpl.storeInsert0(TableRecordImpl.java:176)
	at org.jooq.impl.TableRecordImpl$1.operate(TableRecordImpl.java:142)
	at org.jooq.impl.RecordDelegate.operate(RecordDelegate.java:123)
	at org.jooq.impl.TableRecordImpl.storeInsert(TableRecordImpl.java:138)
	at org.jooq.impl.UpdatableRecordImpl.store0(UpdatableRecordImpl.java:185)
	at org.jooq.impl.UpdatableRecordImpl.access$000(UpdatableRecordImpl.java:85)
	at org.jooq.impl.UpdatableRecordImpl$1.operate(UpdatableRecordImpl.java:135)
	at org.jooq.impl.RecordDelegate.operate(RecordDelegate.java:123)
	at org.jooq.impl.UpdatableRecordImpl.store(UpdatableRecordImpl.java:131)
	at org.jooq.impl.UpdatableRecordImpl.store(UpdatableRecordImpl.java:123)
	at keywhiz.service.daos.SecretSeriesDAO.createSecretSeries(SecretSeriesDAO.java:91)
	at keywhiz.service.daos.SecretDAO.lambda$createSecret$17(SecretDAO.java:93)
	at org.jooq.impl.DefaultDSLContext.transactionResult(DefaultDSLContext.java:318)
	at keywhiz.service.daos.SecretDAO.createSecret(SecretDAO.java:79)
	at keywhiz.service.daos.SecretDAOTest.createOrUpdateSecretWhenSecretExists(SecretDAOTest.java:247)

Write tip

You have a different solution? A short tip here would help you and many other users who saw this issue last week.

Users with the same issue

You are the first who have seen this exception. Write a tip to help other users and build your expert profile.