-
Notifications
You must be signed in to change notification settings - Fork 809
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
fix(resolve): fix resolving reference to CTEs #3220
base: main
Are you sure you want to change the base?
Conversation
+1 on getting this fixed! |
Also waiting for this fix! |
@simonklee Can I get write access to this branch so I can rebase and push some test fixes? |
We should check whether these changes are correct before merging.
Fixed resolving refs to CTEs by adding CTEs to the aliasMap and indexing its columns when resolving catalog references. Fix sqlc-dev#3219
I invited you. I also rebased the branch onto
Runs without failure for me. |
I was able to reproduce it locally with this test setup: extern/sqlc git diff
diff --git a/Makefile b/Makefile
index b4b7e80bc..869a6935f 100644
--- a/Makefile
+++ b/Makefile
@@ -18,6 +18,19 @@ test-examples:
build-endtoend:
cd ./internal/endtoend/testdata && go build ./...
+test-managed:
+ @echo "Starting required services..."
+ docker-compose up -d --remove-orphans
+
+ @echo "Exporting connection strings..."
+ export MYSQL_SERVER_URI="root:mysecretpassword@tcp(localhost:3306)/dinotest?multiStatements=true&parseTime=true"; \
+ export POSTGRESQL_SERVER_URI="postgres://postgres:mysecretpassword@localhost:5432/postgres?sslmode=disable"; \
+ echo "Running tests..."; \
+ go test -tags=example ./...
+
+ @echo "Stopping services..."
+ docker-compose down
+
test-ci: test-examples build-endtoend vet
sqlc-dev: |
I've checked each of them, and it seems correct those fields lose their nullability
I think the updated tests are correct. For instance: -- name: UpdateAttribute :one
with updated_attribute as (UPDATE attribute_value
SET
val = CASE WHEN @filter_value::bool THEN @value ELSE val END
WHERE attribute_value.id = @id
RETURNING id,attribute,val)
select updated_attribute.id, val, name
from updated_attribute
left join attribute on updated_attribute.attribute = attribute.id; had created this struct: type UpdateAttributeParams struct {
FilterValue pgtype.Bool
Value pgtype.Text
ID pgtype.Int8
}
type UpdateAttributeParams struct {
- FilterValue pgtype.Bool
- Value pgtype.Text
- ID pgtype.Int8
+ FilterValue bool
+ Value string
+ ID int64
} The other changes are similar and I've also checked them. To me, Jille's update seems correct. |
When is the merge? |
@simonklee are you still driving this PR? |
I don't exactly know what you mean by "driving" the PR. I don't feel like nudging maintainers to merge pull requests. It was ready in April and I'm using a fork with the changes since February. AFAIK only @kyleconroy and @andrewmbenton have commit access and before the that changes I doubt this PR (or the PR and issue queue) will move much. |
Fixed resolving refs to CTEs by adding CTEs to the aliasMap and indexing its columns when resolving catalog references.
Fix #3219
This is may not be the fix you want. I'm sure there is a better way to resolve this.