Kurt Welgehausen <[EMAIL PROTECTED]> writes:

> [EMAIL PROTECTED] wrote:
>
>> Saying NOT NULL on a PRIMARY KEY is redundant, by the way.
>> --
>> D. Richard Hipp   <[EMAIL PROTECTED]>
>
> **kaw<~/tdpsa>$ sqlite3
> Loading resources from /home/kaw/.sqliterc
> SQLite version 3.3.7
> Enter ".help" for instructions
> sqlite> .nullvalue '<>' 
> sqlite> create table t (k int primary key, d char);
> sqlite> insert into t (k, d) values (1, 'abc');
> sqlite> insert into t (k, d) values (1, 'def');
> SQL error: column k is not unique
> sqlite> insert into t (k, d) values (null, 'ghi');
> sqlite> insert into t (k, d) values (null, 'jkl');
> sqlite> select * from t;
> k           d         
> ----------  ----------
> 1           abc       
> <>          ghi       
> <>          jkl
>
>
> Am I missing something, or should I write a bug ticket
> about a primary key accepting nulls?

Yup.  "int primary key" is not the same as "integer primary key".  Although
I'm using an older version than you are, I got exactly the same results you
did with "int primary key".

SQLite version 3.2.1
Enter ".help" for instructions
sqlite> .nullvalue '<>'
sqlite> create table t (k integer primary key, d char);
sqlite> insert into t (k, d) values (1, 'abc');
sqlite> insert into t (k, d) values (1, 'def');
SQL error: PRIMARY KEY must be unique
sqlite> insert into t (k, d) values (null, 'ghi');
sqlite> insert into t (k, d) values (null, 'jkl');
sqlite> select * from t;
1|abc
2|ghi
3|jkl
sqlite> 

Derrell

-----------------------------------------------------------------------------
To unsubscribe, send email to [EMAIL PROTECTED]
-----------------------------------------------------------------------------

Reply via email to