Skip to content

Overlapping input and output variables in Go, Postgres, pgx/v4 #1559

Closed
@kevinawoo

Description

@kevinawoo

Version

v1.13.0 and 6e45a9f

What happened?

Almost the exactly like #1290, it seems like "sql_package": "pgx/v4" is the cause.

The generated Go code redeclares id on line 3:

func (q *Queries) GetUser(ctx context.Context, id string) (string, error) {
	row := q.db.QueryRow(ctx, getUser, id)
	var id string
	err := row.Scan(&id)
	return id, err
}

Relevant log output

No response

Database schema

-- Example queries for sqlc
CREATE TABLE public.users (
    id character varying(64) NOT NULL
);

SQL queries

-- name: GetUser :one
SELECT *
FROM users
WHERE id = $1
LIMIT 1;

Configuration

{
  "version": "1",
  "packages": [
    {
      "path": "db",
      "engine": "postgresql",
      "schema": "query.sql",
      "queries": "query.sql",
      "sql_package": "pgx/v4"
    }
  ]
}

Playground URL

https://play.sqlc.dev/p/07a36257aa58677adfa4d2558864d0a09ccc286c487893d5854978684b9babe5

What operating system are you using?

macOS

What database engines are you using?

PostgreSQL

What type of code are you generating?

Go

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions