Hi,

can someone help me with this? I have table like this

CREATE TABLE IF NOT EXISTS REVISION_FILE (
  revision_id VARCHAR2 REFERENCES REVISION (revision_id),
  file_name       VARCHAR2,
  PRIMARY KEY (revision_id, file_name)
);

note: if you see any issue with design(varchar pk) irrelevant to problem, 
please ignore it.

now: following insert will work:

insert into REVISION_FILE(REVISION_ID, FILE_NAME) values ('1', '1');   --ok!
insert into REVISION_FILE(REVISION_ID, FILE_NAME) values ('2', '2');   --ok!
insert into REVISION_FILE(REVISION_ID, FILE_NAME) values ('3', '2');   
--FAIL: [23505][23505] Unique index or primary key violation: 
"CONSTRAINT_INDEX_D8 ON PUBLIC.REVISION_FILE(FILE_NAME) VALUES ( /* 3 */ 
'2' )"; SQL statement: insert into REVISION_FILE(REVISION_ID, FILE_NAME) 
values ('3', '2') [23505-176]

BUT!
insert into REVISION_FILE(REVISION_ID, FILE_NAME) values ('2', '3');   --ok!

BUT!
insert intoREVISION_FILE(REVISION_ID, FILE_NAME) values ('3', '3');   
--FAIL:[23505][23505] Unique index or primary key violation: 
"CONSTRAINT_INDEX_D8 ON PUBLIC.REVISION_FILE(FILE_NAME) VALUES ( /* 5 */ 
'3' )"; SQL statement: insert into REVISION_FILE(REVISION_ID, FILE_NAME) 
values ('3', '3') [23505-176]


this does not make any sense — it seems that neither revision_id nor 
file_name has to be unique in certain operations and in other it must be 
unique.

/home/mmucha/.IntelliJIdea15/config/jdbc-drivers/h2-1.3.176.jar

-- 
You received this message because you are subscribed to the Google Groups "H2 
Database" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/h2-database.
For more options, visit https://groups.google.com/d/optout.

Reply via email to