Allow creation unique constraint on same columns in different field order
-------------------------------------------------------------------------

                 Key: CORE-4037
                 URL: http://tracker.firebirdsql.org/browse/CORE-4037
             Project: Firebird Core
          Issue Type: New Feature
          Components: Engine
            Reporter: Karol Bieniaszewski


This is design bug i think
but engine rejects creation of unique constraint on fields placed in different 
order what is not the same at all

i simplify sample to deps scenario but in my app this was words 

try this 
CREATE TABLE DEP_JOIN
(
  ID    INTEGER CONSTRAINT NK_DEP_JOIN__ID NOT NULL,
  DEP1  INTEGER CONSTRAINT NK_DEP_JOIN__DEP1 NOT NULL,
  DEP2  INTEGER CONSTRAINT NK_DEP_JOIN__DEP2 NOT NULL,
CONSTRAINT PK_DEP_JOIN__ID PRIMARY KEY (ID)
);

ALTER TABLE DEP_JOIN
ADD CONSTRAINT UK_DEP_JOIN__DEP1__DEP2 UNIQUE(DEP1, DEP2);
commit;

#################################################################

this  not work but should
ALTER TABLE DEP_JOIN
ADD CONSTRAINT UK_DEP_JOIN__DEP2__DEP1 UNIQUE(DEP2, DEP1);

without second unique constraint this operation cause no possibility to have 
unique join between deps

you can do somethink like this
INSERT INTO DEP_JOIN(ID, DEP1, DEP2) VALUES (1, 1, 2);
INSERT INTO DEP_JOIN(ID, DEP1, DEP2) VALUES (1, 2, 1);

you get 2 join between deps   dep=1 and dep=2 is joined together twice




-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://tracker.firebirdsql.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

------------------------------------------------------------------------------
Master SQL Server Development, Administration, T-SQL, SSAS, SSIS, SSRS
and more. Get SQL Server skills now (including 2012) with LearnDevNow -
200+ hours of step-by-step video tutorials by Microsoft MVPs and experts.
SALE $99.99 this month only - learn more at:
http://p.sf.net/sfu/learnmore_122512
Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel

Reply via email to