Red icon indicating copy to clipboard operation
Red copied to clipboard

Make docs use RETURNING

Open Leont opened this issue 3 years ago • 1 comments

Given that SQLite has added support for RETURNING in 3.35 (2021-03-12), the documentation should probably assume its presence for better readability (and at some later point the implementation should probably follow?)

-- Equivalent to the following query:
INSERT INTO person(
    name
)
VALUES(
    ?
)
-- BIND: ["Fernando"]

-- SQLite needs an extra select:

SELECT
    person.id,
    person.name
FROM
    person
WHERE
    _rowid_ = last_insert_rowid()
LIMIT 1

Would be replaced with

-- Equivalent to the following query:
INSERT INTO person(
    name
)
VALUES(
    ?
)
RETURNING
    person.id,
    person.name
-- BIND: ["Fernando"]

Leont avatar Aug 06 '22 23:08 Leont

Thanks!

FCO avatar Aug 07 '22 03:08 FCO