On Thu, 7 Mar 2013 19:20:44 +0100
Petite Abeille <petite.abei...@gmail.com> wrote:

> > In conclusion, if you want to allow affine type conversions on
> > INSERT, but not disallow values that cannot be so converted, then
> > CHECK(my_column = CAST(my_column AS <TYPE>)) works.  And if you want
> > to disallow values of incorrect types even when type conversion is
> > possible then use CHECK(typeof(my_column = <TYPE>).  That's pretty
> > cool, IMO.
> 
> Yeah? 'cool' is not necessarily how I would describe it? having a
> check constraint 'magically' coerce - change! - the inserted data
> type is? well? not cool. I would call it a misfeature :)

To be clear, the contraints Nico described don't coerce anything.  By
preventing the insertion of values outside the column's domain (per its
affinity), the constraints ensure that future coersions -- as part of a
join, say -- won't lose data.  

--jkl
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to