google-code-export / h2database

Automatically exported from code.google.com/p/h2database
0 stars 1 forks source link

Not consistent way of generating constraints violation messages #293

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
I found that h2 generates constraints violation messages in different manner 
for unique constraints and for referential integrity constraint.

For unique constraints instead of constraint name UNIQUE_INDEX_NAME from 
INFORMATION_SCHEMA.CONSTRAINTS is used.
Example: Unique index or primary key violation: "IDX_UK_CARD_1 ON 
PUBLIC.CARD(NUMBER)"

For referential integrity constraints CONSTRAINT_NAME from 
INFORMATION_SCHEMA.CONSTRAINTS is used.

Example:
Referential integrity constraint violation: "FK_CARD_POLICY_LINK_1: 
PUBLIC.CARD_POLICY_LINK FOREIGN KEY(CARD) REFERENCES PUBLIC.CARD(ID)"

In this situation for me it is hard to parse such messages and extract 
constraint name. I'm going to use constraint name for retrieving REMARKS from 
INFORMATION_SCHEMA.CONSTRAINTS table with user friendly error description.

In my opinion h2 should always use CONSTRAINT_NAME and one template for all 
constraints violation.

in examples above we see, that different templates used
for unique constraints used:
 {constraint_name} ON {table_info}
for referential integrity constraints used:
 {constraint_name}: {table_info}

Original issue reported on code.google.com by kua...@gmail.com on 2 Mar 2011 at 10:11

GoogleCodeExporter commented 9 years ago
> it is hard to parse such messages and extract constraint name.

Why do you want to parse such messages? Why do you want to extract the 
constraint name?

Original comment by thomas.t...@gmail.com on 11 Mar 2011 at 8:15

GoogleCodeExporter commented 9 years ago
Resolving as "won't fix" until there is a clear use case.

Original comment by thomas.t...@gmail.com on 28 Mar 2011 at 7:07