Skip to content

uuid overlap between package name and single argument #1453

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
florentchauveau opened this issue Feb 22, 2022 · 0 comments · Fixed by #2048
Closed

uuid overlap between package name and single argument #1453

florentchauveau opened this issue Feb 22, 2022 · 0 comments · Fixed by #2048

Comments

@florentchauveau
Copy link

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

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

Successfully merging a pull request may close this issue.

2 participants