GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix(sqlite): honor aliases in RETURNING when naming result columns by kevin9327 · Pull Request #4681 · sqlc-dev/sqlc

Conversation

@kevin9327

@kevin9327 kevin9327 commented Nov 11, 2026

Copy link
Copy Markdown

Summary

SQLite RETURNING aliases were ignored when naming generated result columns. convertReturning built each ResTarget from the expression but never set Name, unlike convertResultColumns for SELECT.

Aliases (with or without AS, including quoted identifiers) are now copied onto the target, so names match what SQLite itself reports. This covers INSERT, INSERT … ON CONFLICT DO UPDATE, UPDATE and DELETE.

Fixes #4680

Test plan

Added internal/endtoend/testdata/returning_aliases/sqlite covering the cases from the issue. Goldens generated with the fix show NewID/Doubled (and the other expected names) instead of ID/Column2.

go test -count=1 -timeout 180s -run 'TestReplay/.*/returning' ./internal/endtoend

AI assistance

This change was prepared with assistance from Grok Bot. I reviewed the SQLite converter against the SELECT path, generated the goldens before and after the fix, and ran the returning end-to-end tests locally.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@kevin9327
fix(sqlite): honor aliases in RETURNING when naming result columns
a755d55
convertReturning copied each RETURNING expression into a ResTarget but
never set ResTarget.Name from the column alias, so field names came from
the underlying column or ColumnN. SELECT already passed the alias
through convertResultColumns.

Fixes sqlc-dev#4680

Signed-off-by: kevin9327 <[email protected]>
@manuelschoene manuelschoene mentioned this pull request Nov 11, 2026
fix(sqlite): Keep RETURNING aliases in generated column names #4682
Open
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

sqlite: aliases in RETURNING are ignored when naming result columns

Uh oh!

There was an error while loading. Please reload this page.

1 participant

@kevin9327
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.