I detected that it is possible to enter NULL in a table-column defined as
PRIMARY KEY. Is it a bug or a feature of the "manifest typing" of SQLite? Or is there something in DBD::SQLite going wrong?

Here is a test code:

##################

use strict;
use warnings;
use DBI;

my $dbh = DBI->connect('dbi:SQLite:dbname=TestDB','','',
                      { AutoCommit => 1, RaiseError => 1 });

my $sql = 'CREATE TABLE TestTable (
                a INTEGER PRIMARY KEY,
                b INTEGER NOT NULL,
                c INTEGER
                        )';

$dbh->do($sql);

$dbh->do('INSERT INTO TestTable VALUES (NULL, 1, NULL)');
$dbh->do('INSERT INTO TestTable VALUES (2, NULL, 3)');

$dbh->do('DROP TABLE TestTable');

##################

While executing it complains only about inserting a NULL in column b for the
second INSERT, but not for column a in the first INSERT...

Greetings

Robert

Reply via email to