Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
kevinawoo opened this issue Apr 19, 2022 · 2 comments
Closed

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

kevinawoo opened this issue Apr 19, 2022 · 2 comments

Comments

@kevinawoo
Copy link

kevinawoo commented Apr 19, 2022

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

@kevinawoo kevinawoo added bug Something isn't working triage New issues that hasn't been reviewed labels Apr 19, 2022
@kevinawoo kevinawoo changed the title Overlapping input and output variables in Go pgx/v4 Overlapping input and output variables in Go, Postgres, pgx/v4 Apr 19, 2022
@kyleconroy kyleconroy added 🔧 golang 📚 postgresql 💻 darwin and removed triage New issues that hasn't been reviewed labels Jun 5, 2022
@kyleconroy kyleconroy added this to the v1.15.0 milestone Jun 5, 2022
@zaneli
Copy link
Contributor

zaneli commented Feb 4, 2023

Seems to fixed by #1298
I try to fix for the pgx template. #2058

@kyleconroy kyleconroy modified the milestones: v1.15.0, 1.18.0 Feb 22, 2023
@kyleconroy
Copy link
Collaborator

Fixed! https://play.sqlc.dev/p/d0feca86867bf101295c1429f1d518f432fd6f6e6381d84daefb8c870a5776cc

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

No branches or pull requests

3 participants