On Wed, Dec 2, 2009 at 3:38 AM, Nick Shaw <nick.s...@citysync.co.uk> wrote: > You don't need to define the PRIMARY KEY as NOT NULL - it's implied. > The column constraint flow diagram in the documentation in fact doesn't > allow it: > http://www.sqlite.org/syntaxdiagrams.html#column-constraint > > Maybe that's the problem? Try recreating the table without the NOT NULL > constraint on the "id" column and see if it works after that.
No, that is not the problem. I used the provided code and confirmed that the table and the inserts work just fine. The problem is, as Igor correctly conjectured, most likely with the code that the OP didn't show, the TRIGGERs that might be causing additional INSERTs, and violating the PK constraint. To the original poster, please show the rest of the code that you have omitted from your email. > > Thanks, > Nick. > > -----Original Message----- > From: sqlite-users-boun...@sqlite.org > [mailto:sqlite-users-boun...@sqlite.org] On Behalf Of Brandon Wang > Sent: 01 December 2009 17:06 > To: sqlite-users@sqlite.org > Subject: [sqlite] Possibly a bug in SQLite? > > Hello, > > I've come upon a interesting scenerio. > > .sqlite> .schema rg_configuration > CREATE TABLE 'rg_configuration' ( > "id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, > "configurationName" TEXT NOT NULL, > "host" TEXT, > "user" TEXT, > "parentArch" INTEGER NOT NULL, > "parentJob" INTEGER NOT NULL, > "parentSubblock" INTEGER NOT NULL, > "parentBlock" INTEGER NOT NULL, > "canBeRun" INTEGER DEFAULT (1) > ); > [Addititonal indices, triggers, etc. here] > > One of my scripts attempts to execute the following: > > INSERT INTO main.rg_configuration (configurationName, parentArch, > parentJob, parentSubblock, parentBlock, canBeRun) VALUES > ('full_chip.nofeedthru', 9565, 3014, 33, 8, 1); > > Upon which I get the error: > > SQL error: PRIMARY KEY must be unique > > I'm not specifying the primary key, id. Is there some error on my part? > > Thanks! > > -Brandon > _______________________________________________ > sqlite-users mailing list > sqlite-users@sqlite.org > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users > _______________________________________________ > sqlite-users mailing list > sqlite-users@sqlite.org > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users > -- Puneet Kishor http://www.punkish.org Carbon Model http://carbonmodel.org Charter Member, Open Source Geospatial Foundation http://www.osgeo.org Science Commons Fellow, http://sciencecommons.org/about/whoweare/kishor Nelson Institute, UW-Madison http://www.nelson.wisc.edu ----------------------------------------------------------------------- Assertions are politics; backing up assertions with evidence is science ======================================================================= Sent from Madison, WI, United States _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users