Skip to content

add support for RETURNING clause (PostgreSQL, SQLite) - #310

Open
andreypopp wants to merge 1 commit into
ygrek:masterfrom
andreypopp:returning
Open

add support for RETURNING clause (PostgreSQL, SQLite)#310
andreypopp wants to merge 1 commit into
ygrek:masterfrom
andreypopp:returning

Conversation

@andreypopp

Copy link
Copy Markdown
Contributor

INSERT/UPDATE/DELETE accept a trailing RETURNING clause.

When the number of returned rows is statically known the single-row
variants are used: single-tuple INSERT ... VALUES and INSERT ... SET
map to select_one, ON CONFLICT DO NOTHING makes it select_one_maybe.

The feature is dialect-checked (PostgreSQL, SQLite; -no-check=returning
downgrades to a warning).

RETURNING and conflict clauses on INSERTs with inferred columns (INSERT
INTO t VALUES / SET with nothing following) are rejected, since the
generated tuple is appended textually at the end of the statement
(previously an inferred INSERT with ON CONFLICT silently produced
invalid SQL). This is a limitation of the SQL codegen which can be
lifted in the future.

Co-Authored-By: Claude Fable 5 noreply@anthropic.com

INSERT/UPDATE/DELETE accept a trailing RETURNING clause.

When the number of returned rows is statically known the single-row
variants are used: single-tuple INSERT ... VALUES and INSERT ... SET
map to select_one, ON CONFLICT DO NOTHING makes it select_one_maybe.

The feature is dialect-checked (PostgreSQL, SQLite; -no-check=returning
downgrades to a warning).

RETURNING and conflict clauses on INSERTs with inferred columns (INSERT
INTO t VALUES / SET with nothing following) are rejected, since the
generated tuple is appended textually at the end of the statement
(previously an inferred INSERT with ON CONFLICT silently produced
invalid SQL). This is a limitation of the SQL codegen which can be
lifted in the future.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant