Skip to content

Translate PostgreSQL code 21000 (cardinality_violation) #26276

@OrangeDog

Description

@OrangeDog

If duplicate keys are used in a single upsert (ON CONFLICT DO UPDATE) statement, then postgres returns a cardinality violation error.

There are some options to translate it:

  • UncategorizedSQLException (current)
  • DuplicateKeyException
  • DataIntegrityViolationException
  • a new CardinalityViolationException somewhere in the inheritance tree

I'm currently overriding sql-error-codes.xml in order to return a DuplicateKeyException, as the user cause and exception handling are the same.

Metadata

Metadata

Assignees

Labels

in: dataIssues in data modules (jdbc, orm, oxm, tx)type: enhancementA general enhancement

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions