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

array column added from alter table are generated as non array #2571

Closed
Andy-William opened this issue Aug 3, 2023 · 1 comment · Fixed by #2572
Closed

array column added from alter table are generated as non array #2571

Andy-William opened this issue Aug 3, 2023 · 1 comment · Fixed by #2572
Labels
bug Something isn't working triage New issues that hasn't been reviewed

Comments

@Andy-William
Copy link

Andy-William commented Aug 3, 2023

Version

1.20.0

What happened?

On alter tables, array columns are generated as non array. This doesn't happen in 1.19.

image

Relevant log output

No response

Database schema

-- Example queries for sqlc
CREATE TABLE authors (
  id   BIGSERIAL PRIMARY KEY,
  name text      NOT NULL,
  array1 BIGINT[],
  array2 BIGINT array
);

ALTER TABLE authors ADD COLUMN array3 BIGINT[];
ALTER TABLE authors ADD COLUMN array4 BIGINT array;

SQL queries

-- name: GetAuthor :one
SELECT * FROM (select id from authors) t;

Configuration

{
  "version": "1",
  "packages": [
    {
      "path": "db",
      "engine": "postgresql",
      "schema": "query.sql",
      "queries": "query.sql"
    }
  ]
}

Playground URL

https://play.sqlc.dev/p/09d13d4e8c68bda99da95e6e0af5adf85c60396277614faae148fd8b56a9dec4

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

@Andy-William Andy-William added bug Something isn't working triage New issues that hasn't been reviewed labels Aug 3, 2023
@Andy-William Andy-William changed the title array column added from alter table doesn't work properly array column added from alter table are generated as non array Aug 3, 2023
@pmorelli92
Copy link

I am experiencing the same.

orisano added a commit to orisano/sqlc that referenced this issue Aug 3, 2023
kyleconroy pushed a commit that referenced this issue Aug 3, 2023
…n using "ALTER TABLE ADD COLUMN" (#2572)

* fix(postgres): Fixed a problem with array dimensions disappearing when using "ALTER TABLE ADD COLUMN".

close #2571

* test: update endtoend
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
2 participants