8000 fix(compiler): Pull in array information from analyzer by kyleconroy · Pull Request #2864 · sqlc-dev/sqlc · GitHub
[go: up one dir, main page]

Skip to content

fix(compiler): Pull in array information from analyzer #2864

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

Merged
merged 12 commits into from
Oct 18, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
fix(compiler): Pull in array information from analyzer
Fixes #1532
  • Loading branch information
kyleconroy committed Oct 16, 2023
commit 4684befc2583d861040ef138d2c3ff81b14af1eb
4 changes: 4 additions & 0 deletions internal/compiler/analyze.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ func combineAnalysis(prev *analysis, a *analyzer.Analysis) *analysis {
if len(prev.Columns) == len(cols) {
for i := range prev.Columns {
prev.Columns[i].DataType = cols[i].DataType
prev.Columns[i].IsArray = cols[i].IsArray
prev.Columns[i].ArrayDims = cols[i].ArrayDims
}
} else {
embedding := false
Expand All @@ -73,6 +75,8 @@ func combineAnalysis(prev *analysis, a *analyzer.Analysis) *analysis {
if len(prev.Parameters) == len(params) {
for i := range prev.Parameters {
prev.Parameters[i].Column.DataType = params[i].Column.DataType
prev.Parameters[i].Column.IsArray = params[i].Column.IsArray
prev.Parameters[i].Column.ArrayDims = params[i].Column.ArrayDims
}
} else {
prev.Parameters = params
Expand Down
1 change: 1 addition & 0 deletions internal/endtoend/testdata/update_array_index/issue.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
https://github.com/sqlc-dev/sqlc/issues/1532
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"contexts": ["managed-db"]
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
-- name: UpdateAuthor :one
update authors
set names[$1] = $2
where id=$3
RETURNING *;
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
CREATE TABLE authors (
id BIGSERIAL PRIMARY KEY,
names text[] NOT NULL
);
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
version: "2"
cloud:
project: "01HAQMMECEYQYKFJN8MP16QC41"
sql:
- engine: "postgresql"
schema: "schema.sql"
queries: "query.sql"
gen:
go:
package: "querytest"
out: "go"
sql_package: "pgx/v5"
database:
managed: true
0