Skip to content
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

inconsistent return structures generated #79

Open
bweston92 opened this issue Jan 13, 2023 · 1 comment
Open

inconsistent return structures generated #79

bweston92 opened this issue Jan 13, 2023 · 1 comment

Comments

@bweston92
Copy link
Contributor

bweston92 commented Jan 13, 2023

-- name: FindCollectionsWithAssignee :many
select *
from collections
where assignee = pggen.arg('assignee')
order by created
limit pggen.arg('start') offset pggen.arg('limit');

-- name: FindCollectionWithIdentifier :one
select * from collections where collection_id = pggen.arg('collectionID');

produces:

type FindCollectionWithIdentifierRow struct {
...
	Version      int              `json:"version"`
...
}


type FindCollectionsWithAssigneeRow struct {
...
	Version      *int             `json:"version"`
...

Even if I make them both return :one it still makes the Version member on one of them a pointer when they're referencing the same table and column. I've tried removing everything after the where including the order by and limit and still a inconsistent

@jschaf
Copy link
Owner

jschaf commented Jan 13, 2023

Thanks for reporting. Definitely looks like a bug. Probably similar to #77. Couple of requests to speed up the fix:

  1. What was the pggen command line you used, specifically the --go-type flags?
  2. Can you provide a minimal schema that reproduces the issue?
  3. What's the output of pggen version?

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

No branches or pull requests

2 participants