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(core): name an unnamed result column by position by xen0l · Pull Request #4663 · sqlc-dev/sqlc

Conversation

@xen0l

@xen0l xen0l commented Oct 24, 2026

Copy link
Copy Markdown

Fixes #4657

Problem

targetName returned "?column?" for a result column with no alias that is not a column reference or a function call. The Go generator uses a non-empty name as written, so it emitted var ?column? ... and sqlc generate failed with illegal character U+003F '?'.

The PostgreSQL and SQLite engines name such a column by position (column_1).

Change

targetName (internal/core/analyzer/projection.go) returns an empty name for such a target. The Go generator already falls back to column_N for an empty name (columnName in internal/codegen/golang/result.go). ?column? was the only place in non-test Go code that produced the string.

Tests

New end-to-end case: duckdb_unnamed_columns/duckdb (sqlc generate, output committed). It covers an unaliased CAST, a || expression, two unnamed columns, and a mix of named and unnamed columns. It fails without the change (illegal character U+003F '?') and passes with it.

go test ./internal/endtoend -run TestReplay/base: 971 pass, 58 skip, 0 fail before; 972 pass, 58 skip, 0 fail after. The only difference is the new case. No existing golden contained ?column?.
go test ./internal/engine/... ./internal/core/... ./internal/compiler/... ./internal/codegen/... ./internal/cmd/... ./internal/metadata/... ./internal/sql/...: all ok.

Not run: the managed-db context, --tags=examples, and the internal/goldeneye checks.

Notes

With this change, SELECT * EXCLUDE (...) no longer fails at generate time. It used to fail only because it produced an unnamed column. It now generates []any and fails at run time (expected 3 destination arguments in Scan, not 1). That is a separate problem with its own cause (convertStar returns a TODO node), described in #4660.

Sorry, something went wrong.

Uh oh!

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

All reactions
@xen0l
fix(core): name an unnamed result column by position
1b697f6
targetName returned "?column?" for a result column with no alias that is
not a column reference or a function call. The Go generator uses a
non-empty name as written, so it emitted "var ?column? ..." and
sqlc generate failed with "illegal character U+003F".

Return an empty name. The generator already falls back to column_N for
an empty name, which is what the PostgreSQL and SQLite engines produce.

Adds the duckdb_unnamed_columns end-to-end case.
@xen0l

xen0l commented Nov 10, 2026

Copy link
Copy Markdown
Author

@kyleconroy Could you review this fix for #4657 when you have time, please? Thanks!

All reactions

Sorry, something went wrong.

Uh oh!

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

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.

duckdb: a result column without a name is called ?column?, which is not valid Go

Uh oh!

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

1 participant

@xen0l
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.