Hi Kevin,

I understand the 'NOT NULL' column constraint and the syntax diagram and text describe it quite well. What isn't described is whether or not specifying simply 'NULL' is truly supported. For example, the following create table statement is accepted by SQLite and appears to behave as expected (column 'Id' is not null and column 'Name' is nullable):

create table
(
  Id     integer not null,
  Name   text null
);

I would like to know if 'NULL' is meant to be a valid column constraint or not. It seems to work, but the documentation doesn't mention it explicitly.

Thanks,
-Paul



On 11-Jun-2012 15:35, Kevin Benson wrote:
On Mon, Jun 11, 2012 at 10:35 AM, Paul Medynski<pmedyn...@rim.com>  wrote:

Hi folks,

I notice that the syntax diagram for 'create table' shows the
'column-constraint' definition as requiring 'null' to always be preceded by
'not'.  I don't see any definition that supports just 'null'.  However,
when using SQLite3 3.7.3 or 3.7.9, I can create a table and specify any
column as "Foo<type>  null", and it works as expected allowing the column
to contain null values.

Is the syntax diagram simply out of date, or am I doing something that
appears to work, but will bite me in the end? :)

http://www.sqlite.org/draft/lang_createtable.html

"A CREATE TABLE command specifies the following attributes of the new table:
-
-
-
-
- A default value or expression for each column in the table.
-
-
- A set of SQL constraints for each table. SQLite supports UNIQUE, NOT
NULL, CHECK and FOREIGN KEY constraints."

"A table created using CREATE TABLE AS has no PRIMARY KEY and no
constraints of any kind. The default value of each column is NULL."

--
    --
       --
          --Ô¿Ô--
         K e V i N
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

--

--------------------------------------------------------
Paul Medynski                 BlackBerry Messenger Group
Senior Software Developer             Research In Motion
pmedyn...@rim.com                    50 Innovation Drive
Phone:  +1 902 982 6134                      Bedford, NS
Fax:    +1 902 482 4380                          B4B 0G4

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

Reply via email to