Your table definition seems to have a contradiction.
The expression INTEGER PRIMARY KEY is a special keyword that means
'auto-increment', which would be a default value.  DEFAULT (random() )
would contradict the auto-increment instruction.  The row id was being used
to generate the key.



On Thu, Sep 25, 2014 at 3:10 PM, Mark Lawrence <no...@null.net> wrote:

> Plan:
>
>     CREATE TABLE x(
>         id INTEGER PRIMARY KEY DEFAULT (random()),
>         val VARCHAR
>     );
>
>     INSERT INTO x(val) VALUES ('a');
>     SELECT * FROM x;
>
> Result:
>
>     id          val
>     ----------  ----------
>     1           a
>
> Expected result:
>
>     id                   val
>     -------------------  ----------
>     4841191733402647298  a
>
> I get the expected result if I create the table WITHOUT ROWID.
>
> --
> Mark Lawrence
> _______________________________________________
> 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

Reply via email to