On 2016/07/04 8:21 PM, gwenn wrote:
Hello,

SQLite version 3.13.0 2016-05-18 10:57:30
sqlite> create table test (name text default '');
sqlite> insert into test values ();
Error: near ")": syntax error
sqlite> insert into test values (''), ();
Error: no tables specified

The documentation is clear on this matter I think - It says that if a field-list is not specified, the inserted VALUES must be exactly the number of fields in the table. If the prototype field-list is specified, you may omit one or more of the fields (but not all of them) and the omitted fields will gain their specified default values or NULL where no default is specified. Inserting such a null into a NOT NULL column will be a constraint violation.

The above Insert statements do not conform to this documented requirement. To comply, you /must/ specify one of:
INSERT INTO test (name) VALUES ('')
or
INSERT INTO test VALUES ('')
or
INSERT INTO test DEFAULTS

- All of which should work.


_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to