René's URL Explorer Experiment


Title: Fix parameter handling in CAST expressions for duplicate params by kyleconroy · Pull Request #4384 · sqlc-dev/sqlc · GitHub

Open Graph Title: Fix parameter handling in CAST expressions for duplicate params by kyleconroy · Pull Request #4384 · sqlc-dev/sqlc

X Title: Fix parameter handling in CAST expressions for duplicate params by kyleconroy · Pull Request #4384 · sqlc-dev/sqlc

Description: Summary This PR fixes parameter handling in SQL queries that use CAST expressions with duplicate parameters. Previously, parameters used multiple times within CAST functions were not properly tracked as named parameters, causing incorrect code generation. Fixes #4376 Key Changes Schema Update: Added age column to the test users table to support the new test case Model Update: Added Age field to the User struct to reflect the schema change Query Addition: Added SelectUserByAgeCast test query that uses the same parameter twice within CAST expressions Compiler Fix: Modified resolveCatalogRefs in internal/compiler/resolve.go to properly track whether a parameter is named when resolving CAST type references Now captures the isNamed return value from params.FetchMerge() Sets col.IsNamedParam = isNamed to correctly mark parameters used in CAST expressions Implementation Details The fix ensures that when a parameter appears multiple times in a query (particularly within CAST expressions), the compiler correctly identifies it as a named parameter and generates the appropriate Go code. This prevents duplicate parameter passing and ensures proper parameter binding in the generated SQL execution code. https://claude.ai/code/session_011tJhgjfWrTPw9yY4EpeJXG

Open Graph Description: Summary This PR fixes parameter handling in SQL queries that use CAST expressions with duplicate parameters. Previously, parameters used multiple times within CAST functions were not properly track...

X Description: Summary This PR fixes parameter handling in SQL queries that use CAST expressions with duplicate parameters. Previously, parameters used multiple times within CAST functions were not properly track...

Opengraph URL: https://github.com/sqlc-dev/sqlc/pull/4384

X: @github

direct link

Domain: github.com

route-pattern/:user_id/:repository/pull/:id/files(.:format)
route-controllerpull_requests
route-actionfiles
fetch-noncev2:03eeb2ca-6b93-3cd3-7c45-ea2fb0acede7
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-id8DAA:111468:36D21:491BD:6A510EC3
html-safe-nonce505861b4075ebba4204aa989d84567dcba2a468cc7c50be4dba5340e523e44fd
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4REFBOjExMTQ2ODozNkQyMTo0OTFCRDo2QTUxMEVDMyIsInZpc2l0b3JfaWQiOiI5MTUxMTY2OTQ2ODMzNjY1NzMxIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0=
visitor-hmac2a902f0984f25dd29e9386290aac68192217c73f99e0afb1664bddfadde2bb30
hovercard-subject-tagpull_request:3545522588
github-keyboard-shortcutsrepository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///pull_requests/show/files
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/sqlc-dev/sqlc/pull/4384/files
twitter:imagehttps://avatars.githubusercontent.com/u/34893?s=400&v=4
twitter:cardsummary_large_image
og:imagehttps://avatars.githubusercontent.com/u/34893?s=400&v=4
og:image:altSummary This PR fixes parameter handling in SQL queries that use CAST expressions with duplicate parameters. Previously, parameters used multiple times within CAST functions were not properly track...
og:site_nameGitHub
og:typeobject
hostnamegithub.com
expected-hostnamegithub.com
Noneb076e100febaa00374cd89239f915d00dd3187f7c68b12bc2b7688181305344d
turbo-cache-controlno-preview
diff-viewunified
go-importgithub.com/sqlc-dev/sqlc git https://github.com/sqlc-dev/sqlc.git
octolytics-dimension-user_id136738596
octolytics-dimension-user_loginsqlc-dev
octolytics-dimension-repository_id193160679
octolytics-dimension-repository_nwosqlc-dev/sqlc
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id193160679
octolytics-dimension-repository_network_root_nwosqlc-dev/sqlc
turbo-body-classeslogged-out env-production page-responsive full-width
disable-turbotrue
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
releasef9137f6d981cbbfd780af369f80ce890b2d0d2d4
ui-targetcanary-1
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/sqlc-dev/sqlc/pull/4384/files#start-of-content
https://github.com/
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fsqlc-dev%2Fsqlc%2Fpull%2F4384%2Ffiles
GitHub CopilotWrite better code with AIhttps://github.com/features/copilot
GitHub Copilot appDirect agents from issue to mergehttps://github.com/features/ai/github-app
MCP RegistryNewIntegrate external toolshttps://github.com/mcp
ActionsAutomate any workflowhttps://github.com/features/actions
CodespacesInstant dev environmentshttps://github.com/features/codespaces
IssuesPlan and track workhttps://github.com/features/issues
Code ReviewManage code changeshttps://github.com/features/code-review
GitHub Advanced SecurityFind and fix vulnerabilitieshttps://github.com/security/advanced-security
Code securitySecure your code as you buildhttps://github.com/security/advanced-security/code-security
Secret protectionStop leaks before they starthttps://github.com/security/advanced-security/secret-protection
Why GitHubhttps://github.com/why-github
Documentationhttps://docs.github.com
Bloghttps://github.blog
Changeloghttps://github.blog/changelog
Marketplacehttps://github.com/marketplace
View all featureshttps://github.com/features
Enterpriseshttps://github.com/enterprise
Small and medium teamshttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
App Modernizationhttps://github.com/solutions/use-case/app-modernization
DevSecOpshttps://github.com/solutions/use-case/devsecops
DevOpshttps://github.com/solutions/use-case/devops
CI/CDhttps://github.com/solutions/use-case/ci-cd
View all use caseshttps://github.com/solutions/use-case
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
View all industrieshttps://github.com/solutions/industry
View all solutionshttps://github.com/solutions
AIhttps://github.com/resources/articles?topic=ai
Software Developmenthttps://github.com/resources/articles?topic=software-development
DevOpshttps://github.com/resources/articles?topic=devops
Securityhttps://github.com/resources/articles?topic=security
View all topicshttps://github.com/resources/articles
Customer storieshttps://github.com/customer-stories
Events & webinarshttps://github.com/resources/events
Ebooks & reportshttps://github.com/resources/whitepapers
Business insightshttps://github.com/solutions/executive-insights
GitHub Skillshttps://skills.github.com
Documentationhttps://docs.github.com
Customer supporthttps://support.github.com
Community forumhttps://github.com/orgs/community/discussions
Trust centerhttps://github.com/trust-center
Partnershttps://github.com/partners
View all resourceshttps://github.com/resources
GitHub SponsorsFund open source developershttps://github.com/open-source/sponsors
Security Labhttps://securitylab.github.com
Maintainer Communityhttps://maintainers.github.com
Acceleratorhttps://github.com/open-source/accelerator
GitHub Starshttps://stars.github.com
Archive Programhttps://archiveprogram.github.com
Topicshttps://github.com/topics
Trendinghttps://github.com/trending
Collectionshttps://github.com/collections
Enterprise platformAI-powered developer platformhttps://github.com/enterprise
GitHub Advanced SecurityEnterprise-grade security featureshttps://github.com/security/advanced-security
Copilot for BusinessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Pricinghttps://github.com/pricing
Search syntax tipshttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
documentationhttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fsqlc-dev%2Fsqlc%2Fpull%2F4384%2Ffiles
Sign up https://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fpull_requests%2Fshow%2Ffiles&source=header-repo&source_repo=sqlc-dev%2Fsqlc
Reloadhttps://github.com/sqlc-dev/sqlc/pull/4384/files
Reloadhttps://github.com/sqlc-dev/sqlc/pull/4384/files
Reloadhttps://github.com/sqlc-dev/sqlc/pull/4384/files
Please reload this pagehttps://github.com/sqlc-dev/sqlc/pull/4384/files
sqlc-dev https://github.com/sqlc-dev
sqlchttps://github.com/sqlc-dev/sqlc
Notifications https://github.com/login?return_to=%2Fsqlc-dev%2Fsqlc
Fork 1.1k https://github.com/login?return_to=%2Fsqlc-dev%2Fsqlc
Star 18k https://github.com/login?return_to=%2Fsqlc-dev%2Fsqlc
Code https://github.com/sqlc-dev/sqlc
Issues 597 https://github.com/sqlc-dev/sqlc/issues
Pull requests 106 https://github.com/sqlc-dev/sqlc/pulls
Discussions https://github.com/sqlc-dev/sqlc/discussions
Actions https://github.com/sqlc-dev/sqlc/actions
Projects https://github.com/sqlc-dev/sqlc/projects
Security and quality 0 https://github.com/sqlc-dev/sqlc/security
Insights https://github.com/sqlc-dev/sqlc/pulse
Code https://github.com/sqlc-dev/sqlc
Issues https://github.com/sqlc-dev/sqlc/issues
Pull requests https://github.com/sqlc-dev/sqlc/pulls
Discussions https://github.com/sqlc-dev/sqlc/discussions
Actions https://github.com/sqlc-dev/sqlc/actions
Projects https://github.com/sqlc-dev/sqlc/projects
Security and quality https://github.com/sqlc-dev/sqlc/security
Insights https://github.com/sqlc-dev/sqlc/pulse
Sign up for GitHub https://github.com/signup?return_to=%2Fsqlc-dev%2Fsqlc%2Fissues%2Fnew%2Fchoose
terms of servicehttps://docs.github.com/terms
privacy statementhttps://docs.github.com/privacy
Sign inhttps://github.com/login?return_to=%2Fsqlc-dev%2Fsqlc%2Fissues%2Fnew%2Fchoose
kyleconroyhttps://github.com/kyleconroy
mainhttps://github.com/sqlc-dev/sqlc/tree/main
claude/fix-sqlc-4376-snxzAhttps://github.com/sqlc-dev/sqlc/tree/claude/fix-sqlc-4376-snxzA
Conversation 0 https://github.com/sqlc-dev/sqlc/pull/4384
Commits 1 https://github.com/sqlc-dev/sqlc/pull/4384/commits
Checks 12 https://github.com/sqlc-dev/sqlc/pull/4384/checks
Files changed https://github.com/sqlc-dev/sqlc/pull/4384/files
Please reload this pagehttps://github.com/sqlc-dev/sqlc/pull/4384/files
Fix parameter handling in CAST expressions for duplicate params https://github.com/sqlc-dev/sqlc/pull/4384/files#top
Show all changes 1 commit https://github.com/sqlc-dev/sqlc/pull/4384/files
2d60910 Dedupe sqlc.arg parameters wrapped in a type cast for MySQL claude Apr 17, 2026 https://github.com/sqlc-dev/sqlc/pull/4384/commits/2d60910e66841d0ee273748d7094e560f8e29e5e
Clear filters https://github.com/sqlc-dev/sqlc/pull/4384/files
Please reload this pagehttps://github.com/sqlc-dev/sqlc/pull/4384/files
Please reload this pagehttps://github.com/sqlc-dev/sqlc/pull/4384/files
resolve.go https://github.com/sqlc-dev/sqlc/pull/4384/files#diff-111ef9c1f26d2d0b8ea24733a1871bd77e2bac3c415607a085e092a34cbe6677
models.go https://github.com/sqlc-dev/sqlc/pull/4384/files#diff-5aa4207a2e075e7c7130408485a391733180c562648f29e88cb23014cf40d4fa
query.sql.go https://github.com/sqlc-dev/sqlc/pull/4384/files#diff-dd21604c011b3c7d670fea5bfadcc578c8bc8bbdbca9c6f86319d78680248fe8
query.sql https://github.com/sqlc-dev/sqlc/pull/4384/files#diff-184ef83319caaef55ef7525ec897f542d24b2bc314cf3b2cb0bcbcec5021e3ff
schema.sql https://github.com/sqlc-dev/sqlc/pull/4384/files#diff-a9013ba95d5bf753f1d30cb0e2ddcb49cc1433f126e6c11570b6d388008c08f8
internal/compiler/resolve.gohttps://github.com/sqlc-dev/sqlc/pull/4384/files#diff-111ef9c1f26d2d0b8ea24733a1871bd77e2bac3c415607a085e092a34cbe6677
View file https://github.com/sqlc-dev/sqlc/blob/2d60910e66841d0ee273748d7094e560f8e29e5e/internal/compiler/resolve.go
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/sqlc-dev/sqlc/pull/4384/{{ revealButtonHref }}
https://github.com/sqlc-dev/sqlc/pull/4384/files#diff-111ef9c1f26d2d0b8ea24733a1871bd77e2bac3c415607a085e092a34cbe6677
https://github.com/sqlc-dev/sqlc/pull/4384/files#diff-111ef9c1f26d2d0b8ea24733a1871bd77e2bac3c415607a085e092a34cbe6677
internal/endtoend/testdata/params_duplicate/mysql/go/models.gohttps://github.com/sqlc-dev/sqlc/pull/4384/files#diff-5aa4207a2e075e7c7130408485a391733180c562648f29e88cb23014cf40d4fa
View file https://github.com/sqlc-dev/sqlc/blob/2d60910e66841d0ee273748d7094e560f8e29e5e/internal/endtoend/testdata/params_duplicate/mysql/go/models.go
Open in desktop https://desktop.github.com
how customized files appear on GitHubhttps://docs.github.com/github/administering-a-repository/customizing-how-changed-files-appear-on-github
Please reload this pagehttps://github.com/sqlc-dev/sqlc/pull/4384/files
internal/endtoend/testdata/params_duplicate/mysql/go/query.sql.gohttps://github.com/sqlc-dev/sqlc/pull/4384/files#diff-dd21604c011b3c7d670fea5bfadcc578c8bc8bbdbca9c6f86319d78680248fe8
View file https://github.com/sqlc-dev/sqlc/blob/2d60910e66841d0ee273748d7094e560f8e29e5e/internal/endtoend/testdata/params_duplicate/mysql/go/query.sql.go
Open in desktop https://desktop.github.com
how customized files appear on GitHubhttps://docs.github.com/github/administering-a-repository/customizing-how-changed-files-appear-on-github
Please reload this pagehttps://github.com/sqlc-dev/sqlc/pull/4384/files
internal/endtoend/testdata/params_duplicate/mysql/query.sqlhttps://github.com/sqlc-dev/sqlc/pull/4384/files#diff-184ef83319caaef55ef7525ec897f542d24b2bc314cf3b2cb0bcbcec5021e3ff
View file https://github.com/sqlc-dev/sqlc/blob/2d60910e66841d0ee273748d7094e560f8e29e5e/internal/endtoend/testdata/params_duplicate/mysql/query.sql
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/sqlc-dev/sqlc/pull/4384/{{ revealButtonHref }}
https://github.com/sqlc-dev/sqlc/pull/4384/files#diff-184ef83319caaef55ef7525ec897f542d24b2bc314cf3b2cb0bcbcec5021e3ff
internal/endtoend/testdata/params_duplicate/mysql/schema.sqlhttps://github.com/sqlc-dev/sqlc/pull/4384/files#diff-a9013ba95d5bf753f1d30cb0e2ddcb49cc1433f126e6c11570b6d388008c08f8
View file https://github.com/sqlc-dev/sqlc/blob/2d60910e66841d0ee273748d7094e560f8e29e5e/internal/endtoend/testdata/params_duplicate/mysql/schema.sql
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/sqlc-dev/sqlc/pull/4384/{{ revealButtonHref }}
Please reload this pagehttps://github.com/sqlc-dev/sqlc/pull/4384/files
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.