Skip to content

uuid overlap between package name and single argument #1453

@florentchauveau

Description

@florentchauveau

Version

1.12.0

What happened?

A bug! Cf the playgound: https://play.sqlc.dev/p/12ef4fd5df98251667114c2086d5f3e8c9cf809098e8aa92ed7938a548fd3b24

Output code is not valid:

func (q *Queries) LocationByUuid(ctx context.Context, uuid uuid.UUID) (uuid.UUID, error) {
    row := q.db.QueryRowContext(ctx, locationByUuid, uuid)
    var other_uuid uuid.UUID
    err := row.Scan(&other_uuid)
    return other_uuid, err
}

var other_uuid uuid.UUID cannot work with a param named uuid already.

Relevant log output

uuid.UUID undefined (type uuid.UUID has no field or method UUID) (typecheck)
                       ^

Database schema

-- Example queries for sqlc
CREATE TABLE locations (
  uuid uuid NOT NULL,
  other_uuid uuid NOT NULL,
  name text NOT NULL
);

SQL queries

-- name: LocationByUuid :one
SELECT other_uuid FROM locations WHERE uuid=$1;

Configuration

{
  "version": "1",
  "packages": [
    {
      "path": "db",
      "engine": "postgresql",
      "schema": "query.sql",
      "queries": "query.sql"
    }
  ],
  "overrides": []
}

Playground URL

https://play.sqlc.dev/p/12ef4fd5df98251667114c2086d5f3e8c9cf809098e8aa92ed7938a548fd3b24

What operating system are you using?

Linux

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