* Betr.: " Re: [tryton-dev] Bring some attention on issue1422" (Fri, 2 Apr 2010 16:00:19 +0200):
> > http://dev.mysql.com/doc/refman/5.0/en/create-index.html > > http://bytes.com/topic/oracle/answers/65985-unique-constraint-null-values > > I don't understand what you want to show in those links. I posted them just as examples, how other DBMS handle NULL in UNIQUE and what workarounds are used. If the hack they use to get multiple NULL per UNIQUE column in MS SQL server working also can be adapted to work the other way round for us: great! > Any way, when looking at the comments in oracle thread, I thought about a > solution. > We could add a third integer field with the same value then "parent" but > without the foreign constraint. It will be filled by COALESCE("parent", -1). > The unique constraint will become: > > UNIQUE("name", "parent_") > > We could add a constraint to ensure that both values are always sync: > > CHECK(COASLESCE("parent", -1) = "parent_") > > The "parent_" field will be filled by the override of create and write > functions. > > I know this sounds a little bit hacking but this is my best solution :-) So if this is a solution, that can be used in general for all DBMS in Tryton, I think the overhead and hackish appearence caused by it is compensated by its overall benefit. -- Mathias Behrle MBSolutions Gilgenmatten 10 A D-79114 Freiburg Tel: +49(761)471023 Fax: +49(761)4770816 http://mbsolutions.selfip.biz UStIdNr: DE 142009020 PGP/GnuPG key availabable from any keyserver, ID: 0x89BCA161
signature.asc
Description: PGP signature
