Hi all,

I'm having some trouble in inserting data into a table which its
primary key is set as auto_increment and not null.
The table was created as follows:

CREATE TABLE te_representation (repres_id  INTEGER  AUTO_INCREMENT
NOT NULL ,layer_id  INTEGER ,geom_type  INTEGER ,geom_table  TEXT
,description  TEXT ,lower_x  REAL ,lower_y  REAL ,upper_x  REAL
,upper_y  REAL ,res_x  REAL ,res_y  REAL , num_cols  INTEGER ,num_rows
INTEGER ,initial_time  TEXT ,final_time  TEXT , PRIMARY KEY
(repres_id) );
CREATE INDEX te_idx_representation ON te_representation(layer_id);

And I'm executing this query:

INSERT INTO te_representation (layer_id, geom_type, geom_table,
description,lower_x, lower_y, upper_x, upper_y, res_x, res_y,
num_cols, num_rows) VALUES( 1, 4, 'Points1', '',3.400000e+37,
3.400000e+37, -3.400000e+37, -3.400000e+37, 0.000000e+00,
0.000000e+00, 0, 0);

The sqlite3 complains for the repres_id may not be NULL. I know that
it will work if I remove the repres_id's not null constraint, but this
I wouldn't like to do.

Does the sqlite auto_increment work only with primary keys WITHOUT the
not null constraint? The same query on the same table worked on MySQL.

I would appreciate any idea to work through this.

Thanks in advance.

Best regards.

Bruno

--
/**
* Bruno Silva de Oliveira
* Bacharel em Ciência da Computação
* Mestrando em Inteligência Computacional
* http://www.inf.ufpr.br/brunoso/
*
* http://www.last.fm/user/bsoliveira/
*/

Reply via email to