Skip to Content
0

[301]: unique constraint violated: Table(P_INDEXES_), Index(IDX_P_INDEXES_PK)

Feb 06 at 02:33 PM

95

avatar image
Former Member

Hello! I faced weird error during creating constraints for table. Three steps to reproduce case:

1) Creating very simple table:

CREATE TABLE "SCHEMA_NAME"."SIMPLE_TABLE" ( "C_INT" INTEGER , "C_CHAR" CHAR(10) );

No any data inserted!

2) Creating check constraint:

ALTER TABLE "SCHEMA_NAME"."SIMPLE_TABLE" ADD CONSTRAINT "C_INT" CHECK("C_INT" BETWEEN 0 AND 100);

3) Creating unique constraint:

ALTER TABLE "SCHEMA_NAME"."SIMPLE_TABLE" ADD CONSTRAINT "UNIK" UNIQUE ("C_CHAR");

At creating unique constraint I'm getting error "[301]: unique constraint violated: Table(P_INDEXES_), Index(IDX_P_INDEXES_PK)".

I tried different names for table and constraints but same result. Have no idea what's happening.

Any suggestions please.

10 |10000 characters needed characters left characters exceeded

Did you by any chance already create another constraint with the name "UNIK"? Maybe for a different table?

If so, then that's the cause for the error message, as all constraints share the same namespace and have to have unique names.

You can check this with the following select statement:

select * 
from 
     constraints
where constraint_name ='UNIK';
0
Former Member
Lars Breddemann

Checked. No any constraints with this name.

0

Looks like there's something fishy with your database. Maybe there is a corruption in the system tables. You could go and check that with the consistency checks.

I tried the sequence of commands you provided and that doesn't reproduce your problem. You may consider opening a support incident for this one.

1
Former Member
Lars Breddemann

It seems like you right. Tried this case with another Hana instance and it works as well.

Thak you for help and advices!

0
* Please Login or Register to Answer, Follow or Comment.

0 Answers