René's URL Explorer Experiment


Title: compiler: a scalar subquery's column is nullable by ken-talltree-io · Pull Request #4654 · sqlc-dev/sqlc · GitHub

Open Graph Title: compiler: a scalar subquery's column is nullable by ken-talltree-io · Pull Request #4654 · sqlc-dev/sqlc

X Title: compiler: a scalar subquery's column is nullable by ken-talltree-io · Pull Request #4654 · sqlc-dev/sqlc

Description: A scalar subquery yields NULL when it matches no row, but the legacy analyzer gave its column the nullability of the column it selects, so (select r.id from reviews r where r.book_id = b.id limit 1) came out non-null. This makes it nullable unless the subquery always yields exactly one row: an aggregate with no GROUP BY, HAVING or LIMIT ((select count(*) …) stays non-null), or a SELECT with no FROM. Fixes #4262. The new nullable_scalar_subquery fixture covers a subquery through a view and inline; it fails without the change in both the base and managed-db contexts. With PostgreSQL available, every TestReplay case passes, and no existing expected output changes. CASE … ELSE NULL::type has the same problem on this path; I've left it to #3739, which reworks CASE (see my comment there about column-reference results). 🤖 Generated with Claude Code

Open Graph Description: A scalar subquery yields NULL when it matches no row, but the legacy analyzer gave its column the nullability of the column it selects, so (select r.id from reviews r where r.book_id = b.id limit 1...

X Description: A scalar subquery yields NULL when it matches no row, but the legacy analyzer gave its column the nullability of the column it selects, so (select r.id from reviews r where r.book_id = b.id limit 1...

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

X: @github

direct link

Domain: github.com

react-profiling0
react-import-mapreact,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322
route-pattern/:user_id/:repository/pull/:id/files(.:format)
route-controllerpull_requests
route-actionfiles
fetch-noncev2:b6ebf1d2-b2e7-430a-098d-e138f6c0d468
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-idC828:14F601:2B385A4:36D7D42:6B019369
html-safe-nonce6b3a30da74ddf0546eb482f3ede4f8bc1a7e090fbdb4b1287594dfe1b6af70aa
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDODI4OjE0RjYwMToyQjM4NUE0OjM2RDdENDI6NkIwMTkzNjkiLCJ2aXNpdG9yX2lkIjoiNjc1MDc5NTc3NDc4MDYwOTM4NSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmacca49e19dc5c8fc5606c6e08ee03b74addac49505f8e987e23f3fa0f466ae22fa
hovercard-subject-tagpull_request:4995836616
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/4654/files
twitter:imagehttps://avatars.githubusercontent.com/u/225744437?s=400&v=4
twitter:cardsummary_large_image
og:imagehttps://avatars.githubusercontent.com/u/225744437?s=400&v=4
og:image:altA scalar subquery yields NULL when it matches no row, but the legacy analyzer gave its column the nullability of the column it selects, so (select r.id from reviews r where r.book_id = b.id limit 1...
og:site_nameGitHub
og:typeobject
hostnamegithub.com
expected-hostnamegithub.com
Nonecc5dfdd32f62ebd3223cab3af3aa2b268d3605218237326a48a99d1efd89495c
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
release8c77c9e8439031ad54c75a250694842892f693e1
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/sqlc-dev/sqlc/pull/4654/files#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fsqlc-dev%2Fsqlc%2Fpull%2F4654%2Ffiles
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
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
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://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
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fsqlc-dev%2Fsqlc%2Fpull%2F4654%2Ffiles
Sign uphttps://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/4654/files
Reloadhttps://github.com/sqlc-dev/sqlc/pull/4654/files
Reloadhttps://github.com/sqlc-dev/sqlc/pull/4654/files
sqlc-devhttps://github.com/sqlc-dev
sqlchttps://github.com/sqlc-dev/sqlc
Codehttps://github.com/sqlc-dev/sqlc
Issues600 (600)https://github.com/sqlc-dev/sqlc/issues
Pull requests132 (132)https://github.com/sqlc-dev/sqlc/pulls
Discussionshttps://github.com/sqlc-dev/sqlc/discussions
Actionshttps://github.com/sqlc-dev/sqlc/actions
Projectshttps://github.com/sqlc-dev/sqlc/projects
Security and qualityhttps://github.com/sqlc-dev/sqlc/security
Insightshttps://github.com/sqlc-dev/sqlc/insights
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
ken-talltree-iohttps://github.com/ken-talltree-io
sqlc-dev:mainhttps://github.com/sqlc-dev/sqlc/tree/main
ken-talltree-io:fix-4262-nullable-subquery-casehttps://github.com/ken-talltree-io/sqlc/tree/fix-4262-nullable-subquery-case
Conversation 2 https://github.com/sqlc-dev/sqlc/pull/4654
Commits 4 https://github.com/sqlc-dev/sqlc/pull/4654/commits
Checks 13 https://github.com/sqlc-dev/sqlc/pull/4654/checks
Files changed https://github.com/sqlc-dev/sqlc/pull/4654/files
Please reload this pagehttps://github.com/sqlc-dev/sqlc/pull/4654/files
compiler: a scalar subquery's column is nullable https://github.com/sqlc-dev/sqlc/pull/4654/files#top
Show all changes 4 commits https://github.com/sqlc-dev/sqlc/pull/4654/files
0bb6a6e compiler: a scalar subquery's column is nullable ken-talltree-io Oct 24, 2026 https://github.com/sqlc-dev/sqlc/pull/4654/commits/0bb6a6e79193852b30c5963cacd245387fe49899
540c5b9 compiler: an aggregate inside an expression still yields one row Bockit Nov 14, 2026 https://github.com/sqlc-dev/sqlc/pull/4654/commits/540c5b901a8db9ce35b76736fdddff8ef72ea537
7eb8516 compiler: only count keeps an expression in a scalar subquery never null Bockit Nov 14, 2026 https://github.com/sqlc-dev/sqlc/pull/4654/commits/7eb8516a9eabf7ee32ac6fa88d8b1a09974c9f0c
e972462 endtoend: regenerate nullable_scalar_subquery_aggregate on main ken-talltree-io Nov 14, 2026 https://github.com/sqlc-dev/sqlc/pull/4654/commits/e9724628da07e55e9d20b861bd88e69314e25e0b
Clear filters https://github.com/sqlc-dev/sqlc/pull/4654/files
Please reload this pagehttps://github.com/sqlc-dev/sqlc/pull/4654/files
Please reload this pagehttps://github.com/sqlc-dev/sqlc/pull/4654/files
output_columns.go https://github.com/sqlc-dev/sqlc/pull/4654/files#diff-10352986f0bc3f9bd887ba90e50c3ff0d93f284b24a9a8c059f1f1bc0aaba061
issue.md https://github.com/sqlc-dev/sqlc/pull/4654/files#diff-b72042d3de3583232d2bcee85a815ef051924a8e5cb8a6b53624f6a7eac91415
db.go https://github.com/sqlc-dev/sqlc/pull/4654/files#diff-afdf5c0a98bbeac85f9f78cf2a8e7087a47ee56b800068207e344d70531a762a
models.go https://github.com/sqlc-dev/sqlc/pull/4654/files#diff-161ad5e253cf5a857c3a4653713d54634f6dc2b739a5e2812ca531bef1159500
query.sql.go https://github.com/sqlc-dev/sqlc/pull/4654/files#diff-2ccd32ec54d5303cd88fdd22a6ac7561cf3bb5eed760b3afe158533ff03651f6
query.sql https://github.com/sqlc-dev/sqlc/pull/4654/files#diff-eaeb515715cee1034a8d8aa43864764e944c8e1081b7ef10c5dc9c1697f6531b
schema.sql https://github.com/sqlc-dev/sqlc/pull/4654/files#diff-da2d9d15ab5e73f3f08e65713567bc025ae2a3f3b0a410cfe613ec2941d74672
sqlc.yaml https://github.com/sqlc-dev/sqlc/pull/4654/files#diff-5417215109e01d46d5718b425bfd14121bbbf1dd0918c9f54d93a0dda9002f74
db.go https://github.com/sqlc-dev/sqlc/pull/4654/files#diff-feb181ab3cb89ccd6b5c8c26bc4ff1b5ec3bd42550c0796e62e3f256862b79a8
models.go https://github.com/sqlc-dev/sqlc/pull/4654/files#diff-3ca275ac28616528aaa6f4ffa2dda67bae2d7d6387191b2d8f5972949636ee61
query.sql.go https://github.com/sqlc-dev/sqlc/pull/4654/files#diff-ca476f413026a87fcdbe5bcd71cc33eb428bb333acb75fd13369b1568f351aa3
query.sql https://github.com/sqlc-dev/sqlc/pull/4654/files#diff-5728ce3fdae46cdae3db3752085e29c7b08a025a206bdc11cb4ee2709dab55b4
schema.sql https://github.com/sqlc-dev/sqlc/pull/4654/files#diff-18b5cb2b60adc99b08e9df69f94e60432fe88d95cf1f56c1e112703f1ef31cc6
sqlc.yaml https://github.com/sqlc-dev/sqlc/pull/4654/files#diff-5dfb650449acb6f665375b5f322693be27fff8ca0114356f08c147c13955d9cc
internal/compiler/output_columns.gohttps://github.com/sqlc-dev/sqlc/pull/4654/files#diff-10352986f0bc3f9bd887ba90e50c3ff0d93f284b24a9a8c059f1f1bc0aaba061
View file https://github.com/sqlc-dev/sqlc/blob/e9724628da07e55e9d20b861bd88e69314e25e0b/internal/compiler/output_columns.go
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/sqlc-dev/sqlc/pull/4654/{{ revealButtonHref }}
https://github.com/sqlc-dev/sqlc/pull/4654/files#diff-10352986f0bc3f9bd887ba90e50c3ff0d93f284b24a9a8c059f1f1bc0aaba061
https://github.com/sqlc-dev/sqlc/pull/4654/files#diff-10352986f0bc3f9bd887ba90e50c3ff0d93f284b24a9a8c059f1f1bc0aaba061
https://github.com/sqlc-dev/sqlc/pull/4654/files#diff-10352986f0bc3f9bd887ba90e50c3ff0d93f284b24a9a8c059f1f1bc0aaba061
https://github.com/sqlc-dev/sqlc/pull/4654/files#diff-10352986f0bc3f9bd887ba90e50c3ff0d93f284b24a9a8c059f1f1bc0aaba061
https://github.com/sqlc-dev/sqlc/pull/4654/files#diff-10352986f0bc3f9bd887ba90e50c3ff0d93f284b24a9a8c059f1f1bc0aaba061
internal/endtoend/testdata/nullable_scalar_subquery/postgresql/issue.mdhttps://github.com/sqlc-dev/sqlc/pull/4654/files#diff-b72042d3de3583232d2bcee85a815ef051924a8e5cb8a6b53624f6a7eac91415
View file https://github.com/sqlc-dev/sqlc/blob/e9724628da07e55e9d20b861bd88e69314e25e0b/internal/endtoend/testdata/nullable_scalar_subquery/postgresql/issue.md
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/sqlc-dev/sqlc/pull/4654/{{ revealButtonHref }}
internal/endtoend/testdata/nullable_scalar_subquery/postgresql/stdlib/go/db.gohttps://github.com/sqlc-dev/sqlc/pull/4654/files#diff-afdf5c0a98bbeac85f9f78cf2a8e7087a47ee56b800068207e344d70531a762a
View file https://github.com/sqlc-dev/sqlc/blob/e9724628da07e55e9d20b861bd88e69314e25e0b/internal/endtoend/testdata/nullable_scalar_subquery/postgresql/stdlib/go/db.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/4654/files
internal/endtoend/testdata/nullable_scalar_subquery/postgresql/stdlib/go/models.gohttps://github.com/sqlc-dev/sqlc/pull/4654/files#diff-161ad5e253cf5a857c3a4653713d54634f6dc2b739a5e2812ca531bef1159500
View file https://github.com/sqlc-dev/sqlc/blob/e9724628da07e55e9d20b861bd88e69314e25e0b/internal/endtoend/testdata/nullable_scalar_subquery/postgresql/stdlib/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/4654/files
internal/endtoend/testdata/nullable_scalar_subquery/postgresql/stdlib/go/query.sql.gohttps://github.com/sqlc-dev/sqlc/pull/4654/files#diff-2ccd32ec54d5303cd88fdd22a6ac7561cf3bb5eed760b3afe158533ff03651f6
View file https://github.com/sqlc-dev/sqlc/blob/e9724628da07e55e9d20b861bd88e69314e25e0b/internal/endtoend/testdata/nullable_scalar_subquery/postgresql/stdlib/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/4654/files
internal/endtoend/testdata/nullable_scalar_subquery/postgresql/stdlib/query.sqlhttps://github.com/sqlc-dev/sqlc/pull/4654/files#diff-eaeb515715cee1034a8d8aa43864764e944c8e1081b7ef10c5dc9c1697f6531b
View file https://github.com/sqlc-dev/sqlc/blob/e9724628da07e55e9d20b861bd88e69314e25e0b/internal/endtoend/testdata/nullable_scalar_subquery/postgresql/stdlib/query.sql
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/sqlc-dev/sqlc/pull/4654/{{ revealButtonHref }}
internal/endtoend/testdata/nullable_scalar_subquery/postgresql/stdlib/schema.sqlhttps://github.com/sqlc-dev/sqlc/pull/4654/files#diff-da2d9d15ab5e73f3f08e65713567bc025ae2a3f3b0a410cfe613ec2941d74672
View file https://github.com/sqlc-dev/sqlc/blob/e9724628da07e55e9d20b861bd88e69314e25e0b/internal/endtoend/testdata/nullable_scalar_subquery/postgresql/stdlib/schema.sql
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/sqlc-dev/sqlc/pull/4654/{{ revealButtonHref }}
internal/endtoend/testdata/nullable_scalar_subquery/postgresql/stdlib/sqlc.yamlhttps://github.com/sqlc-dev/sqlc/pull/4654/files#diff-5417215109e01d46d5718b425bfd14121bbbf1dd0918c9f54d93a0dda9002f74
View file https://github.com/sqlc-dev/sqlc/blob/e9724628da07e55e9d20b861bd88e69314e25e0b/internal/endtoend/testdata/nullable_scalar_subquery/postgresql/stdlib/sqlc.yaml
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/sqlc-dev/sqlc/pull/4654/{{ revealButtonHref }}
internal/endtoend/testdata/nullable_scalar_subquery_aggregate/postgresql/pgx/go/db.gohttps://github.com/sqlc-dev/sqlc/pull/4654/files#diff-feb181ab3cb89ccd6b5c8c26bc4ff1b5ec3bd42550c0796e62e3f256862b79a8
View file https://github.com/sqlc-dev/sqlc/blob/e9724628da07e55e9d20b861bd88e69314e25e0b/internal/endtoend/testdata/nullable_scalar_subquery_aggregate/postgresql/pgx/go/db.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/4654/files
internal/endtoend/testdata/nullable_scalar_subquery_aggregate/postgresql/pgx/go/models.gohttps://github.com/sqlc-dev/sqlc/pull/4654/files#diff-3ca275ac28616528aaa6f4ffa2dda67bae2d7d6387191b2d8f5972949636ee61
View file https://github.com/sqlc-dev/sqlc/blob/e9724628da07e55e9d20b861bd88e69314e25e0b/internal/endtoend/testdata/nullable_scalar_subquery_aggregate/postgresql/pgx/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/4654/files
Please reload this pagehttps://github.com/sqlc-dev/sqlc/pull/4654/files
Please reload this pagehttps://github.com/sqlc-dev/sqlc/pull/4654/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.