On 02/04/10 17:17 +0200, Mathias Behrle wrote:
> > 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.
> 

Yes it will work for any DBMS that handle UNIQUE constraint (PostgreSQL, MySQL
and SQLite).

-- 
Cédric Krier

B2CK SPRL
Rue de Rotterdam, 4
4000 Liège
Belgium
Tel: +32 472 54 46 59
Email/Jabber: [email protected]
Website: http://www.b2ck.com/

Attachment: pgpxRFB7UpEa1.pgp
Description: PGP signature

Reply via email to