René's URL Explorer Experiment


Title: Delete query with join returns panic: expected range var error · Issue #3848 · sqlc-dev/sqlc · GitHub

Open Graph Title: Delete query with join returns panic: expected range var error · Issue #3848 · sqlc-dev/sqlc

X Title: Delete query with join returns panic: expected range var error · Issue #3848 · sqlc-dev/sqlc

Description: Version 1.28.0 What happened? When generating a query with a delete statement that uses a join, sqlc returns this error: panic: expected range var The code itself works in my database if I run it native. I've made a simplified version of...

Open Graph Description: Version 1.28.0 What happened? When generating a query with a delete statement that uses a join, sqlc returns this error: panic: expected range var The code itself works in my database if I run it n...

X Description: Version 1.28.0 What happened? When generating a query with a delete statement that uses a join, sqlc returns this error: panic: expected range var The code itself works in my database if I run it n...

Opengraph URL: https://github.com/sqlc-dev/sqlc/issues/3848

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Delete query with join returns panic: expected range var error","articleBody":"### Version\n\n1.28.0\n\n### What happened?\n\nWhen generating a query with a delete statement that uses a join, sqlc returns this error:\n\n`panic: expected range var`\n\nThe code itself works in my database if I run it native. I've made a simplified version of my database and query to show the issue.\n\n### Relevant log output\n\n```shell\npanic: expected range var\n\ngoroutine 7 [running]:\ngithub.com/sqlc-dev/sqlc/internal/engine/dolphin.convertToRangeVarList(0xc00006aa40?, 0xc0004bb3b0)\n\t/home/wout/go/pkg/mod/github.com/sqlc-dev/sqlc@v1.28.0/internal/engine/dolphin/utils.go:68 +0x328\ngithub.com/sqlc-dev/sqlc/internal/engine/dolphin.(*cc).convertDeleteStmt(0xc00006aa40, 0xc000b93cc0)\n\t/home/wout/go/pkg/mod/github.com/sqlc-dev/sqlc@v1.28.0/internal/engine/dolphin/convert.go:302 +0x90\ngithub.com/sqlc-dev/sqlc/internal/engine/dolphin.(*cc).convert(0xc00006aa40, {0x1e8c7e0?, 0xc000b93cc0?})\n\t/home/wout/go/pkg/mod/github.com/sqlc-dev/sqlc@v1.28.0/internal/engine/dolphin/convert.go:1557 +0x3e5\ngithub.com/sqlc-dev/sqlc/internal/engine/dolphin.(*Parser).Parse(0xc0000a70f8, {0x1e692e0?, 0xc0007f14c0?})\n\t/home/wout/go/pkg/mod/github.com/sqlc-dev/sqlc@v1.28.0/internal/engine/dolphin/parse.go:63 +0x205\ngithub.com/sqlc-dev/sqlc/internal/compiler.(*Compiler).parseQueries(0xc000474008, {{0x0, 0x0, {0x0, 0x0}, 0x0, 0x0, 0x0, 0x0}})\n\t/home/wout/go/pkg/mod/github.com/sqlc-dev/sqlc@v1.28.0/internal/compiler/compile.go:75 +0x24e\ngithub.com/sqlc-dev/sqlc/internal/compiler.(*Compiler).ParseQueries(...)\n\t/home/wout/go/pkg/mod/github.com/sqlc-dev/sqlc@v1.28.0/internal/compiler/engine.go:72\ngithub.com/sqlc-dev/sqlc/internal/cmd.parse({_, _}, {_, _}, {_, _}, {{0x0, 0x0}, {0xc000438866, 0x5}, ...}, ...)\n\t/home/wout/go/pkg/mod/github.com/sqlc-dev/sqlc@v1.28.0/internal/cmd/generate.go:322 +0x2dc\ngithub.com/sqlc-dev/sqlc/internal/cmd.processQuerySets.func1()\n\t/home/wout/go/pkg/mod/github.com/sqlc-dev/sqlc@v1.28.0/internal/cmd/process.go:107 +0x81a\ngolang.org/x/sync/errgroup.(*Group).Go.func1()\n\t/home/wout/go/pkg/mod/golang.org/x/sync@v0.10.0/errgroup/errgroup.go:78 +0x50\ncreated by golang.org/x/sync/errgroup.(*Group).Go in goroutine 1\n\t/home/wout/go/pkg/mod/golang.org/x/sync@v0.10.0/errgroup/errgroup.go:75 +0x96\n```\n\n### Database schema\n\n```sql\nCREATE TABLE `conflicts` (\n  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,\n  `currency_id` int(10) unsigned NOT NULL,\n  `blockchain_id` int(10) unsigned NOT NULL,\n  `reference` varchar(255) NOT NULL,\n  PRIMARY KEY (`id`)\n);\n```\n\n### SQL queries\n\n```sql\n-- name: DeleteConflicts :execrows\nDELETE conflicts\nFROM conflicts\n  JOIN (\n      SELECT blockchain_id, reference\n        FROM conflicts\n    GROUP BY blockchain_id, reference\n      HAVING COUNT(DISTINCT currency_id) = 1\n  ) AS resolved_conflicts\n    ON conflicts.blockchain_id = resolved_conflicts.blockchain_id\n   AND conflicts.reference = resolved_conflicts.reference;\n```\n\n### Configuration\n\n```yaml\nversion: \"2\"\ncloud:\n    organization: \"\"\n    project: \"\"\n    hostname: \"\"\nsql:\n  - schema: ./sql/schema.sql\n    queries: ./sql/queries\n    engine: mysql\n    gen:\n      go:\n        package: sqlc\n        out: ./_sqlc\n        emit_json_tags: true\n        emit_prepared_queries: false\n        emit_interface: false\n        emit_exact_table_names: true\noverrides:\n    go: null\nplugins: []\nrules: []\noptions: {}\n```\n\n### Playground URL\n\nhttps://play.sqlc.dev/p/8b36238bfbc667bc2478394d370938fdaad11bd2c82df63a5e59f17b699b24f0\n\n### What operating system are you using?\n\nLinux\n\n### What database engines are you using?\n\nMySQL\n\n### What type of code are you generating?\n\nGo","author":{"url":"https://github.com/wouthoekstra","@type":"Person","name":"wouthoekstra"},"datePublished":"2025-02-17T10:37:56.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":1},"url":"https://github.com/3848/sqlc/issues/3848"}

route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:c90e53e6-52f3-a5cd-6cec-c3c9798bce38
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idD84A:73E1D:636497:854E9F:6A504C9A
html-safe-nonce060b7445a18e991099704d69a5f0b0b12ecbe66f2d034117f262d2c03932beb4
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEODRBOjczRTFEOjYzNjQ5Nzo4NTRFOUY6NkE1MDRDOUEiLCJ2aXNpdG9yX2lkIjoiMzk5NDUwNDYwOTk1OTc5MTc3MCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmaca419c548929b378f287e6bff7a6bcca622d3d3f685e7514b8dac44d3a6d5eba0
hovercard-subject-tagissue:2857448284
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/sqlc-dev/sqlc/3848/issue_layout
twitter:imagehttps://opengraph.githubassets.com/5509b81e14808ccd322d5201639e67a074f00ba21651e1723dc2006a44f94539/sqlc-dev/sqlc/issues/3848
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/5509b81e14808ccd322d5201639e67a074f00ba21651e1723dc2006a44f94539/sqlc-dev/sqlc/issues/3848
og:image:altVersion 1.28.0 What happened? When generating a query with a delete statement that uses a join, sqlc returns this error: panic: expected range var The code itself works in my database if I run it n...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamewouthoekstra
hostnamegithub.com
expected-hostnamegithub.com
Noned6dc8294eb500fa36bbc57472d61fe87c522f9c3c1d64f70f4926f66a66a7efb
turbo-cache-controlno-preview
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
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release5741a45fe07e5f377d0d4c524a92e3056acc51bb
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/sqlc-dev/sqlc/issues/3848#start-of-content
https://github.com/
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fsqlc-dev%2Fsqlc%2Fissues%2F3848
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%2Fissues%2F3848
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%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=sqlc-dev%2Fsqlc
Reloadhttps://github.com/sqlc-dev/sqlc/issues/3848
Reloadhttps://github.com/sqlc-dev/sqlc/issues/3848
Reloadhttps://github.com/sqlc-dev/sqlc/issues/3848
Please reload this pagehttps://github.com/sqlc-dev/sqlc/issues/3848
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
#4023https://github.com/sqlc-dev/sqlc/pull/4023
Delete query with join returns panic: expected range var errorhttps://github.com/sqlc-dev/sqlc/issues/3848#top
#4023https://github.com/sqlc-dev/sqlc/pull/4023
📚 mysqlhttps://github.com/sqlc-dev/sqlc/issues?q=state%3Aopen%20label%3A%22%3Abooks%3A%20mysql%22
💻 linuxhttps://github.com/sqlc-dev/sqlc/issues?q=state%3Aopen%20label%3A%22%3Acomputer%3A%20linux%22
🔧 golanghttps://github.com/sqlc-dev/sqlc/issues?q=state%3Aopen%20label%3A%22%3Awrench%3A%20golang%22
bugSomething isn't workinghttps://github.com/sqlc-dev/sqlc/issues?q=state%3Aopen%20label%3A%22bug%22
https://github.com/wouthoekstra
wouthoekstrahttps://github.com/wouthoekstra
on Feb 17, 2025https://github.com/sqlc-dev/sqlc/issues/3848#issue-2857448284
https://play.sqlc.dev/p/8b36238bfbc667bc2478394d370938fdaad11bd2c82df63a5e59f17b699b24f0https://play.sqlc.dev/p/8b36238bfbc667bc2478394d370938fdaad11bd2c82df63a5e59f17b699b24f0
📚 mysqlhttps://github.com/sqlc-dev/sqlc/issues?q=state%3Aopen%20label%3A%22%3Abooks%3A%20mysql%22
💻 linuxhttps://github.com/sqlc-dev/sqlc/issues?q=state%3Aopen%20label%3A%22%3Acomputer%3A%20linux%22
🔧 golanghttps://github.com/sqlc-dev/sqlc/issues?q=state%3Aopen%20label%3A%22%3Awrench%3A%20golang%22
bugSomething isn't workinghttps://github.com/sqlc-dev/sqlc/issues?q=state%3Aopen%20label%3A%22bug%22
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.