Skip to content

postgres arrays now generated as scalars in models #2605

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
josharian opened this issue Aug 11, 2023 · 2 comments
Closed

postgres arrays now generated as scalars in models #2605

josharian opened this issue Aug 11, 2023 · 2 comments
Labels
bug Something isn't working triage New issues that hasn't been reviewed

Comments

@josharian
Copy link
Contributor

Version

1.20.0

What happened?

In v1.19.x, our model looked like:

type Bonus struct {
	ID              uuid.UUID
        // snip
	Employees       []int32
}

Generated with v.1.20.0, it is now:

type Bonus struct {
	ID              uuid.UUID
        // snip
	Employees       int32
}

The slice for Employees has been lost.

Bisected to 3c9ef73 (cc @colli173)

# \d bonus;
                                               Table "public.bonus"
      Column       |              Type              | Collation | Nullable |               Default                
-------------------+--------------------------------+-----------+----------+--------------------------------------
 id                | uuid                           |           | not null | gen_random_uuid()
-- snip
 employees         | integer[]                      |           | not null | '{}'::integer[]

This blocks us from upgrading to v1.20.

Relevant log output

No response

Database schema

No response

SQL queries

No response

Configuration

No response

Playground URL

No response

What operating system are you using?

macOS

What database engines are you using?

PostgreSQL

What type of code are you generating?

Go

@josharian josharian added bug Something isn't working triage New issues that hasn't been reviewed labels Aug 11, 2023
@orisano
Copy link
Contributor

orisano commented Aug 11, 2023

@josharian Is it a column added with ALTER TABLE?
If so, #2572 may have solved the problem. (not yet released)

Can you reproduce it in playground (play.sqlc.dev)?

@josharian
Copy link
Contributor Author

Yeah, appears to be fixed at main. Thanks, 🤞🏽 for a release soon.

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