Skip to content

Add returning clause support#780

Open
cerredz wants to merge 1 commit into
sqlkata:mainfrom
cerredz:issuehunt-8-returning-clause
Open

Add returning clause support#780
cerredz wants to merge 1 commit into
sqlkata:mainfrom
cerredz:issuehunt-8-returning-clause

Conversation

@cerredz
Copy link
Copy Markdown

@cerredz cerredz commented May 16, 2026

Closes #8.

Adds a query-level Returning(...) / ReturningRaw(...) API for insert and update queries, with compiler placement hooks so engines can render dialect-specific output clauses.

Implemented dialects:

  • PostgreSQL: appends RETURNING ... after insert/update statements.
  • SQL Server: emits OUTPUT INSERTED... in the correct position before the insert source or update WHERE clause.

Unsupported compilers now fail fast if a returning clause is compiled instead of silently generating invalid SQL.

Verification:

  • dotnet test QueryBuilder.Tests\QueryBuilder.Tests.csproj --filter FullyQualifiedName~InsertTests|FullyQualifiedName~UpdateTests
  • dotnet test QueryBuilder.Tests\QueryBuilder.Tests.csproj --filter FullyQualifiedName!~MySqlExecutionTest
  • Full unfiltered test run reaches 336 passing / 1 skipped before failing only the MySQL integration fixture because this environment has no MySQL host configured.
  • git diff --check

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.

Returning clause

1 participant