Skip to content

duckdb: the rowid pseudo-column is an unknown column #4676

Open

Description

@Jyrno42

Version

Other

main at commit 3ad8b20, built with CGO_ENABLED=0 go install github.com/sqlc-dev/sqlc/cmd/sqlc@3ad8b20fb02b5bea81591b673da0758b8685d951. sqlc version prints v1.31.1.

What happened?

Every DuckDB base table has a rowid pseudo-column (BIGINT) that can be selected, filtered on and ordered by. DuckDB sqlc engine does not know it:

query sqlc
SELECT rowid, id FROM plan unknown column "rowid"
SELECT p.rowid, p.id FROM plan p unknown column "p"."rowid"
SELECT id FROM plan WHERE rowid = $1 where: unknown column "rowid"
SELECT id FROM plan ORDER BY rowid order by: unknown column "rowid"

all of these work on duckdb 2.0, DESCRIBE SELECT rowid FROM plan reports a nullable BIGINT.

Relevant log output

# package q
queries/query.sql:1:1: unknown column "rowid"

Database schema

CREATE TABLE plan (
    id UUID NOT NULL,
    ship_size VARCHAR NOT NULL,
    price DOUBLE
);

SQL queries

-- name: WithRowID :many
SELECT rowid, id FROM plan;

-- name: ByRowID :one
SELECT id FROM plan WHERE rowid = $1;

Configuration

version: "2"
sql:
  - engine: "duckdb"
    schema: "schema.sql"
    queries: "queries"
    gen:
      go:
        package: "q"
        out: "q"
        sql_package: "database/sql"

Playground URL

No response

What operating system are you using?

Linux

What database engines are you using?

DuckDB

What type of code are you generating?

Go

Activity

  1. RyoKusnadi commented on Nov 6, 2026

    @RyoKusnadi

    @kyleconroy I opened #4678 for this. Could you please review it when you have a moment? Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions