sqlc icon indicating copy to clipboard operation
sqlc copied to clipboard

uuid overlap between package name and single argument

Open florentchauveau opened this issue 3 years ago • 0 comments

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

florentchauveau avatar Feb 22 '22 14:02 florentchauveau