SQLite Forum

Error: near "returning": syntax error
Login

Error: near "returning": syntax error

(1) By anonymous on 2021-03-27 21:24:39 [link] [source]

create table test(id integer primary key);
insert into test default values returning id;

Shouldn't this return a single row with a single column with a value of 1?

(2.1) By Tim Streater (Clothears) on 2021-03-27 21:47:14 edited from 2.0 in reply to 1 [source]

Third-Mini% sqlite3

SQLite version 3.35.2 2021-03-17 19:07:21

Enter ".help" for usage hints.

Connected to a transient in-memory database.

Use ".open FILENAME" to reopen on a persistent database.

sqlite> create table test(id integer primary key);

sqlite> insert into test default values returning id;

1

sqlite>

Third-Mini%

What's yer problem?

(3) By anonymous on 2021-03-27 23:07:03 in reply to 2.1 [link] [source]

$ sqlite3
SQLite version 3.30.0 2019-10-04 15:03:17
Enter ".help" for usage hints.
Connected to a transient in-memory database.
Use ".open FILENAME" to reopen on a persistent database.
sqlite> create table test(id integer primary key);
sqlite> insert into test default values returning id;
Error: near "returning": syntax error
sqlite> 


Guess I need an upgrade.

(4) By Larry Brasfield (larrybr) on 2021-03-27 23:50:15 in reply to 3 [link] [source]

Yes. Support for the RETURNING clause came with version 3.35.0.