Skip to content

Array of nullable items in aggregates #1413

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
Yamakaky opened this issue Feb 4, 2022 · 2 comments
Closed

Array of nullable items in aggregates #1413

Yamakaky opened this issue Feb 4, 2022 · 2 comments
Labels
bug Something isn't working triage New issues that hasn't been reviewed

Comments

@Yamakaky
Copy link

Yamakaky commented Feb 4, 2022

Version

1.11.0

What happened?

Lets say I want to run this request:

create table sometable (
  key text not null,
  value text
);
select key, array_agg(value)::text[] from sometable group by key;

sqlc will generate a struct like this:

type QueryRow struct {
	Key   text
	Value []string
}

However, some values may be null, which will fail with a scan error. Is there a way to tell sqlc to generate Value []sql.NullString?

Relevant log output

No response

Database schema

create table sometable (
  key text not null,
  value text
);

SQL queries

select key, array_agg(value)::text[] from sometable group by key;

Configuration

No response

Playground URL

No response

What operating system are you using?

No response

What database engines are you using?

No response

What type of code are you generating?

No response

@Yamakaky Yamakaky added bug Something isn't working triage New issues that hasn't been reviewed labels Feb 4, 2022
@Yamakaky Yamakaky changed the title Array of nullable items Array of nullable items in aggregates Feb 4, 2022
@kyleconroy
Copy link
Collaborator

Duplicate of #185

@kyleconroy kyleconroy marked this as a duplicate of #185 Feb 4, 2022
@Yamakaky
Copy link
Author

Yamakaky commented Feb 5, 2022

Wow, my bad, I missed that one

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working triage New issues that hasn't been reviewed
Projects
None yet
Development

No branches or pull requests

2 participants