Title: Fields not nullable when INNER JOINing to a LEFT JOIN · Issue #604 · sqlc-dev/sqlc · GitHub
Open Graph Title: Fields not nullable when INNER JOINing to a LEFT JOIN · Issue #604 · sqlc-dev/sqlc
X Title: Fields not nullable when INNER JOINing to a LEFT JOIN · Issue #604 · sqlc-dev/sqlc
Description: This contrived example: CREATE TABLE users ( user_id INT PRIMARY KEY, city_id INT -- nullable ); CREATE TABLE cities ( city_id INT PRIMARY KEY, mayor_id INT NOT NULL ); CREATE TABLE mayors ( mayor_id INT PRIMARY KEY, full_name TEXT NOT N...
Open Graph Description: This contrived example: CREATE TABLE users ( user_id INT PRIMARY KEY, city_id INT -- nullable ); CREATE TABLE cities ( city_id INT PRIMARY KEY, mayor_id INT NOT NULL ); CREATE TABLE mayors ( mayor_...
X Description: This contrived example: CREATE TABLE users ( user_id INT PRIMARY KEY, city_id INT -- nullable ); CREATE TABLE cities ( city_id INT PRIMARY KEY, mayor_id INT NOT NULL ); CREATE TABLE mayors ( mayor_...
Opengraph URL: https://github.com/sqlc-dev/sqlc/issues/604
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Fields not nullable when INNER JOINing to a LEFT JOIN","articleBody":"This contrived example:\r\n```sql\r\nCREATE TABLE users (\r\n user_id INT PRIMARY KEY,\r\n city_id INT -- nullable\r\n);\r\nCREATE TABLE cities (\r\n city_id INT PRIMARY KEY,\r\n mayor_id INT NOT NULL\r\n);\r\nCREATE TABLE mayors (\r\n mayor_id INT PRIMARY KEY,\r\n full_name TEXT NOT NULL\r\n);\r\n\r\n-- name: GetMayors :many\r\nSELECT\r\n user_id,\r\n mayors.full_name\r\nFROM users\r\nLEFT JOIN cities USING (city_id)\r\nINNER JOIN mayors USING (mayor_id);\r\n```\r\n\r\nProduces this results struct:\r\n```go\r\ntype GetMayorsRow struct {\r\n\tUserID int32\r\n\tFullName string\r\n}\r\n```\r\n\r\nRunning this query will fail if `city_id` is `NULL`. Because of the left join, the correct type for `FullName` is `sql.NullString`.","author":{"url":"https://github.com/maxhawkins","@type":"Person","name":"maxhawkins"},"datePublished":"2020-07-21T18:29:04Z","url":"https://github.com/sqlc-dev/sqlc/issues/604"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:3d5cae67-ec68-5a60-79dc-16535ef91ea4 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | B28E:3DD488:20B7E51:29847B1:6B0174AF |
| html-safe-nonce | 40771aa94240b273cf0ca7ab9f565bdd698db2f461d79e25c314dff71245ddb0 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCMjhFOjNERDQ4ODoyMEI3RTUxOjI5ODQ3QjE6NkIwMTc0QUYiLCJ2aXNpdG9yX2lkIjoiMzkxMzI1ODEzOTU2MjExMjE3NSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | fd10fef1d54d7911128d01ef3a5dfb5d90dfb39d1569a651fe8798f0ab35dd73 |
| hovercard-subject-tag | issue:663221293 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/sqlc-dev/sqlc/604/issue_layout |
| twitter:image | https://opengraph.githubassets.com/0040379a9a269830c1bbd423c4066e65943fedf27aa6cc09cb7f0fce25963673/sqlc-dev/sqlc/issues/604 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/0040379a9a269830c1bbd423c4066e65943fedf27aa6cc09cb7f0fce25963673/sqlc-dev/sqlc/issues/604 |
| og:image:alt | This contrived example: CREATE TABLE users ( user_id INT PRIMARY KEY, city_id INT -- nullable ); CREATE TABLE cities ( city_id INT PRIMARY KEY, mayor_id INT NOT NULL ); CREATE TABLE mayors ( mayor_... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | maxhawkins |
| hostname | github.com |
| expected-hostname | github.com |
| None | cc5dfdd32f62ebd3223cab3af3aa2b268d3605218237326a48a99d1efd89495c |
| turbo-cache-control | no-preview |
| go-import | github.com/sqlc-dev/sqlc git https://github.com/sqlc-dev/sqlc.git |
| octolytics-dimension-user_id | 136738596 |
| octolytics-dimension-user_login | sqlc-dev |
| octolytics-dimension-repository_id | 193160679 |
| octolytics-dimension-repository_nwo | sqlc-dev/sqlc |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 193160679 |
| octolytics-dimension-repository_network_root_nwo | sqlc-dev/sqlc |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 8c77c9e8439031ad54c75a250694842892f693e1 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width