On 11/24/08, Satish <[EMAIL PROTECTED]> wrote:
> Hi All!
>
>
>
>   I have created a table in sqlite.Upto my knowledge a column which is
>  declared as primary key will not accept null and even if I don't give any
>  value to that field an error occurs that violating the constraint
>
>  For Example
>
>  Create table emp(empno integer PRIMARY KEY,...,...)
>
>  .         Even if I give u a NULL as a value to the field that is declared
>  as primary key .it is accepting
>
>  .         Even if I Don't give any value to the field that is declared as
>  primary key it is auto incrementing. Instead of showing the error constraint
>  violated it is  auto increment that field value(I did not specify the column
>  to auto increment).
>
>
>

from the docs <http://www.sqlite.org/lang_createtable.html>

"According to the SQL standard, PRIMARY KEY should imply NOT NULL.
Unfortunately, due to a long-standing coding oversight, this is not
the case in SQLite. SQLite allows NULL values in a PRIMARY KEY column.
We could change SQLite to conform to the standard (and we might do so
in the future), but by the time the oversight was discovered, SQLite
was in such wide use that we feared breaking legacy code if we fixed
the problem. So for now we have chosen to continue allowing NULLs in
PRIMARY KEY columns. Developers should be aware, however, that we may
change SQLite to conform to the SQL standard in future and should
design new programs accordingly."


>
>
>  Regards,
>
>  Satish.G
>
>
>
>  _______________________________________________
>  sqlite-users mailing list
>  sqlite-users@sqlite.org
>  http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>


-- 
Puneet Kishor http://punkish.eidesis.org/
Nelson Institute for Environmental Studies http://www.nelson.wisc.edu/
Open Source Geospatial Foundation (OSGeo) http://www.osgeo.org/
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to