Shankar Unni writes:
 > I don't see implementation of "CHECK" CONSTRAINTS in the TODO list (e.g. 
 > 
 >   CONSTRAINT val_ck check (val >= 0 and val <=5)
 > 
 > Is this planned? 
 > 
 > I do see FOREIGN KEY constraints on the 4.0 list, so there is a way to do
 > this kind of checking once this is implemented:
 > 
 > * Create an associated "range-check" table with a primary key column, and
 > add rows for the values you want to allow in your table column.
 > * Put a foreign key constraint on your column to point at that table.
 > 
 > This will at least ensure that you get a constraint violation if you attempt
 > to insert something illegal.
 > 
 > This works only for small ranges or other enumeration types (integer or
 > string). E.g.
 > 
 >  create table check_phase_number (phase integer);
 >  insert into check_phase_number values (1),(2),(3),(4),(5);
 > 
 >  create table check_state_abbrev (state char(2));
 >  insert into check_state_abbrev values ('AK'),('AL'),('CA'), ...
 > ('VT'),('WA');
 > 
 >  create table my_state_migration (
 >    phase integer constraint phase_fk foreign key references
 > check_phase_number(phase),
 >    state char(2) constraint state_fk foreign key references
 > check_state_abbrev(state),
 >    ...
 >  );
 > 

Hi!

We shall definitely consider putting it in 4.* branch.


Regards,

Sinisa

      ____  __     _____   _____  ___     ==  MySQL AB
     /*/\*\/\*\   /*/ \*\ /*/ \*\ |*|     Sinisa Milivojevic
    /*/ /*/ /*/   \*\_   |*|   |*||*|     mailto:[EMAIL PROTECTED]
   /*/ /*/ /*/\*\/*/  \*\|*|   |*||*|     Larnaca, Cyprus
  /*/     /*/  /*/\*\_/*/ \*\_/*/ |*|____
  ^^^^^^^^^^^^/*/^^^^^^^^^^^\*\^^^^^^^^^^^
             /*/             \*\                Developers Team

---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to