Skip to content

Invalid go generated code when there's only one field and it's named "q" #3627

Closed
@lsmoura

Description

@lsmoura

Version

1.27.0

What happened?

The generated function func (q *Queries) GetAuthorWithQ(ctx context.Context, q sql.NullString) ([]Author, error) has both a q struct and q parameter, which is invalid go syntax.

Relevant log output

No response

Database schema

CREATE TABLE authors (
  id   BIGSERIAL PRIMARY KEY,
  name text      NOT NULL,
  bio  text,
  q    text
);

SQL queries

-- name: GetAuthorWithQ :many
SELECT * FROM authors
WHERE q = $1
ORDER BY name;

Configuration

No response

Playground URL

https://play.sqlc.dev/p/ba6e22e495b02c910c219f86bc6b9b145bbf2af16fff7913059fdb26889b4ec3

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

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions