René's URL Explorer Experiment


Title: Go panics when sub query is missing an alias with sqlite · Issue #3514 · sqlc-dev/sqlc · GitHub

Open Graph Title: Go panics when sub query is missing an alias with sqlite · Issue #3514 · sqlc-dev/sqlc

X Title: Go panics when sub query is missing an alias with sqlite · Issue #3514 · sqlc-dev/sqlc

Description: Version 1.26.0 What happened? I accidentally left an alias off my subquery and I got a panic instead of a useful error message. Failing playground without alias (included below as well): https://play.sqlc.dev/p/9bd88a936c60738a57503c6314...

Open Graph Description: Version 1.26.0 What happened? I accidentally left an alias off my subquery and I got a panic instead of a useful error message. Failing playground without alias (included below as well): https://pl...

X Description: Version 1.26.0 What happened? I accidentally left an alias off my subquery and I got a panic instead of a useful error message. Failing playground without alias (included below as well): https://pl...

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

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Go panics when sub query is missing an alias with sqlite","articleBody":"### Version\n\n1.26.0\n\n### What happened?\n\nI accidentally left an alias off my subquery and I got a panic instead of a useful error message.\r\n\r\nFailing playground without alias (included below as well): https://play.sqlc.dev/p/9bd88a936c60738a57503c6314f5805316327b3dbf51a03c49518ff729382b44\r\n\r\nPassing playground with alias: https://play.sqlc.dev/p/47e54486a69100bf2e6e61436518f642835859e73a7ba42ab89f0f74234be50c\r\n\r\nExample with postgres that gives a useful error message instead of the panic: https://play.sqlc.dev/p/dd2d6eaf25d9bef2b07e1cd7dc5a4b949694ba6d200b419724d13a513c1eaf1a\n\n### Relevant log output\n\n```shell\npanic: runtime error: invalid memory address or nil pointer dereference\r\n[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x10d0247]\r\n\r\ngoroutine 6 [running]:\r\ngithub.com/sqlc-dev/sqlc/internal/compiler.(*Compiler).sourceTables(0xc00049c008, 0xc00048ed50, {0x1d84f80?, 0xc0009d9ad0?})\r\n        /home/user/.asdf/installs/golang/1.22.2/packages/pkg/mod/github.com/sqlc-dev/sqlc@v1.26.0/internal/compiler/output_columns.go:601 +0xaa7\r\ngithub.com/sqlc-dev/sqlc/internal/compiler.(*Compiler).outputColumns(0xc00049c008, 0xc00048ed50, {0x1d84f80, 0xc0009d9ad0})\r\n        /home/user/.asdf/installs/golang/1.22.2/packages/pkg/mod/github.com/sqlc-dev/sqlc@v1.26.0/internal/compiler/output_columns.go:55 +0x45\r\ngithub.com/sqlc-dev/sqlc/internal/compiler.(*Compiler)._analyzeQuery(0xc00049c008, 0xc000f8fde0, {0xc000062fcc, 0x83}, 0x1)\r\n        /home/user/.asdf/installs/golang/1.22.2/packages/pkg/mod/github.com/sqlc-dev/sqlc@v1.26.0/internal/compiler/analyze.go:180 +0xced\r\ngithub.com/sqlc-dev/sqlc/internal/compiler.(*Compiler).analyzeQuery(...)\r\n        /home/user/.asdf/installs/golang/1.22.2/packages/pkg/mod/github.com/sqlc-dev/sqlc@v1.26.0/internal/compiler/analyze.go:110\r\ngithub.com/sqlc-dev/sqlc/internal/compiler.(*Compiler).parseQuery(0xc00049c008, {0x1d85140, 0xc000f8fde0}, {0xc000062c00, 0x5d5}, {{0x0, 0x0, {0x0, 0x0}, 0x0, ...}})\r\n        /home/user/.asdf/installs/golang/1.22.2/packages/pkg/mod/github.com/sqlc-dev/sqlc@v1.26.0/internal/compiler/parse.go:103 +0x5d5\r\ngithub.com/sqlc-dev/sqlc/internal/compiler.(*Compiler).parseQueries(0xc00049c008, {{0x0, 0x0, {0x0, 0x0}, 0x0, 0x0, 0x0, 0x0}})\r\n        /home/user/.asdf/installs/golang/1.22.2/packages/pkg/mod/github.com/sqlc-dev/sqlc@v1.26.0/internal/compiler/compile.go:81 +0x467\r\ngithub.com/sqlc-dev/sqlc/internal/compiler.(*Compiler).ParseQueries(...)\r\n        /home/user/.asdf/installs/golang/1.22.2/packages/pkg/mod/github.com/sqlc-dev/sqlc@v1.26.0/internal/compiler/engine.go:76\r\ngithub.com/sqlc-dev/sqlc/internal/cmd.parse({_, _}, {_, _}, {_, _}, {{0x0, 0x0}, {0xc00047629a, 0x6}, ...}, ...)\r\n        /home/user/.asdf/installs/golang/1.22.2/packages/pkg/mod/github.com/sqlc-dev/sqlc@v1.26.0/internal/cmd/generate.go:322 +0x30b\r\ngithub.com/sqlc-dev/sqlc/internal/cmd.processQuerySets.func1()\r\n        /home/user/.asdf/installs/golang/1.22.2/packages/pkg/mod/github.com/sqlc-dev/sqlc@v1.26.0/internal/cmd/process.go:107 +0x877\r\ngolang.org/x/sync/errgroup.(*Group).Go.func1()\r\n        /home/user/.asdf/installs/golang/1.22.2/packages/pkg/mod/golang.org/x/sync@v0.6.0/errgroup/errgroup.go:78 +0x56\r\ncreated by golang.org/x/sync/errgroup.(*Group).Go in goroutine 1\r\n        /home/user/.asdf/installs/golang/1.22.2/packages/pkg/mod/golang.org/x/sync@v0.6.0/errgroup/errgroup.go:75 +0x96\n```\n\n\n### Database schema\n\n```sql\nCREATE TABLE clients (\r\n    id INTEGER NOT NULL, \r\n    created_at DATETIME DEFAULT (CURRENT_TIMESTAMP) NOT NULL, \r\n    updated_at DATETIME DEFAULT (CURRENT_TIMESTAMP) NOT NULL, \r\n    deleted_at DATETIME, \r\n    external_id VARCHAR(36) NOT NULL, \r\n    meta JSON NOT NULL, \r\n    PRIMARY KEY (id), \r\n    UNIQUE (external_id)\r\n);\n```\n\n\n### SQL queries\n\n```sql\n-- name: GetNextClientID :one\r\nSELECT max(external_id) FROM (\r\n  SELECT external_id FROM clients\r\n  ORDER BY external_id\r\n  LIMIT ?\r\n);\n```\n\n\n### Configuration\n\n```yaml\nversion: \"2\"\r\nsql:\r\n  - engine: \"sqlite\"\r\n    queries: \"internal/database/query.sql\"\r\n    schema: \"internal/database/migrations\"\r\n    gen:\r\n      go:\r\n        package: \"database\"\r\n        out: \"internal/database\"\n```\n\n\n### Playground URL\n\nhttps://play.sqlc.dev/p/9bd88a936c60738a57503c6314f5805316327b3dbf51a03c49518ff729382b44\n\n### What operating system are you using?\n\nLinux\n\n### What database engines are you using?\n\nSQLite\n\n### What type of code are you generating?\n\nGo","author":{"url":"https://github.com/leetrout","@type":"Person","name":"leetrout"},"datePublished":"2024-08-02T03:54:27.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":3},"url":"https://github.com/3514/sqlc/issues/3514"}

route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:4304e2b4-dd67-1f3b-4b62-ce4ab91b398b
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-id816A:1DCECA:7FCF93:B6514B:6A51060F
html-safe-noncea08157f4cb7353b6e6c267a58912bc85784c1bf75244e227b8664b75b757c4d5
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4MTZBOjFEQ0VDQTo3RkNGOTM6QjY1MTRCOjZBNTEwNjBGIiwidmlzaXRvcl9pZCI6IjI1NDYyNTQ3NTAyODM3OTM5MzUiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ==
visitor-hmacd378a8f825a9d433705db0682aeec5c5ef6c00a2c345c0a6194e119a9fb76cff
hovercard-subject-tagissue:2443952110
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/3514/issue_layout
twitter:imagehttps://opengraph.githubassets.com/c90bca160a2ebe936102a31ec9d9e28f88f9760c8df7f1f205d7ae1d140b967f/sqlc-dev/sqlc/issues/3514
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/c90bca160a2ebe936102a31ec9d9e28f88f9760c8df7f1f205d7ae1d140b967f/sqlc-dev/sqlc/issues/3514
og:image:altVersion 1.26.0 What happened? I accidentally left an alias off my subquery and I got a panic instead of a useful error message. Failing playground without alias (included below as well): https://pl...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernameleetrout
hostnamegithub.com
expected-hostnamegithub.com
Noneb076e100febaa00374cd89239f915d00dd3187f7c68b12bc2b7688181305344d
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
release2d129404fc45ea64edb1b98567c53e55b395536f
ui-targetcanary-2
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/sqlc-dev/sqlc/issues/3514#start-of-content
https://github.com/
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fsqlc-dev%2Fsqlc%2Fissues%2F3514
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%2F3514
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/3514
Reloadhttps://github.com/sqlc-dev/sqlc/issues/3514
Reloadhttps://github.com/sqlc-dev/sqlc/issues/3514
Please reload this pagehttps://github.com/sqlc-dev/sqlc/issues/3514
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
Go panics when sub query is missing an alias with sqlitehttps://github.com/sqlc-dev/sqlc/issues/3514#top
bugSomething isn't workinghttps://github.com/sqlc-dev/sqlc/issues?q=state%3Aopen%20label%3A%22bug%22
https://github.com/leetrout
leetrouthttps://github.com/leetrout
on Aug 2, 2024https://github.com/sqlc-dev/sqlc/issues/3514#issue-2443952110
https://play.sqlc.dev/p/9bd88a936c60738a57503c6314f5805316327b3dbf51a03c49518ff729382b44https://play.sqlc.dev/p/9bd88a936c60738a57503c6314f5805316327b3dbf51a03c49518ff729382b44
https://play.sqlc.dev/p/47e54486a69100bf2e6e61436518f642835859e73a7ba42ab89f0f74234be50chttps://play.sqlc.dev/p/47e54486a69100bf2e6e61436518f642835859e73a7ba42ab89f0f74234be50c
https://play.sqlc.dev/p/dd2d6eaf25d9bef2b07e1cd7dc5a4b949694ba6d200b419724d13a513c1eaf1ahttps://play.sqlc.dev/p/dd2d6eaf25d9bef2b07e1cd7dc5a4b949694ba6d200b419724d13a513c1eaf1a
https://play.sqlc.dev/p/9bd88a936c60738a57503c6314f5805316327b3dbf51a03c49518ff729382b44https://play.sqlc.dev/p/9bd88a936c60738a57503c6314f5805316327b3dbf51a03c49518ff729382b44
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.