Title: Enums in joins are not treated as nullable · Issue #1157 · sqlc-dev/sqlc · GitHub
Open Graph Title: Enums in joins are not treated as nullable · Issue #1157 · sqlc-dev/sqlc
X Title: Enums in joins are not treated as nullable · Issue #1157 · sqlc-dev/sqlc
Description: Version 1.9.0 What happened? Support for nullable columns in joins were added in v1.9.0. Unfortunately, it appears this doesn't extend to the auto-generated enum types. As can be seen in the generated Go types, the ListBooksRow contains ...
Open Graph Description: Version 1.9.0 What happened? Support for nullable columns in joins were added in v1.9.0. Unfortunately, it appears this doesn't extend to the auto-generated enum types. As can be seen in the genera...
X Description: Version 1.9.0 What happened? Support for nullable columns in joins were added in v1.9.0. Unfortunately, it appears this doesn't extend to the auto-generated enum types. As can be seen in the ge...
Opengraph URL: https://github.com/sqlc-dev/sqlc/issues/1157
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Enums in joins are not treated as nullable","articleBody":"### Version\n\n1.9.0\n\n### What happened?\n\nSupport for nullable columns in joins were added in v1.9.0. Unfortunately, it appears this doesn't extend to the auto-generated enum types. As can be seen in the generated Go types, the `ListBooksRow` contains an `sql.NullString`, but the enum type is not similarly nullable.\r\n\r\nThere's a bit of a design discussion to be had around what the best way to handle this is, since enums use a custom type. Perhaps a pointer would be enough, so that it could be null?\r\n\r\nRelated to #374\n\n### Relevant log output\n\n_No response_\n\n### Database schema\n\n```sql\nCREATE TABLE authors (\r\n id BIGSERIAL PRIMARY KEY,\r\n name TEXT NOT NULL\r\n);\r\n\r\nCREATE TYPE book_type AS ENUM ('hardback', 'softback', 'ebook');\r\n\r\nCREATE TABLE books (\r\n id BIGSERIAL PRIMARY KEY,\r\n title TEXT NOT NULL,\r\n book_type book_type NOT NULL,\r\n author_id BIGINT NULL REFERENCES authors(id)\r\n);\n```\n\n\n### SQL queries\n\n```sql\n-- name: ListBooks :many\r\nSELECT authors.name, books.title, books.book_type FROM authors\r\nLEFT JOIN books ON authors.id = books.author_id;\n```\n\n\n### Configuration\n\n```yaml\nversion: 1\r\npackages:\r\n - path: \"tutorial\"\r\n name: \"tutorial\"\r\n engine: \"postgresql\"\r\n schema: \"schema.sql\"\r\n queries: \"query.sql\"\n```\n\n\n### Playground URL\n\nhttps://play.sqlc.dev/p/086e386e94012b813b228429fc8067716c2b68e66db27de20699daafdb9d12b9\n\n### What operating system are you using?\n\nLinux\n\n### What database engines are you using?\n\nPostgreSQL\n\n### What type of code are you generating?\n\nGo","author":{"url":"https://github.com/johanbrandhorst","@type":"Person","name":"johanbrandhorst"},"datePublished":"2021-08-29T16:29:40Z","url":"https://github.com/sqlc-dev/sqlc/issues/1157"}
| 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:1aad904b-5c44-747e-18b9-faabd35f1c1c |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | D742:399E4B:212F747:2BFAE87:6B017B3B |
| html-safe-nonce | 3e68eb962fb1fec31cb7c9104369110fd2a7db888f76bbba6da72eed02d14174 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJENzQyOjM5OUU0QjoyMTJGNzQ3OjJCRkFFODc6NkIwMTdCM0IiLCJ2aXNpdG9yX2lkIjoiMjgwMTAyNDQ1Nzg3ODEwODk4NyIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | ded0c481c7121e1f25007b33d25a4229cc8f294e2450ab51f1f60f1500862a17 |
| hovercard-subject-tag | issue:982143485 |
| 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/1157/issue_layout |
| twitter:image | https://opengraph.githubassets.com/b59b899ec9293a7fd6c64a8e488509c42a4ed00bcce0d2dc8a152cc13722a4c7/sqlc-dev/sqlc/issues/1157 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/b59b899ec9293a7fd6c64a8e488509c42a4ed00bcce0d2dc8a152cc13722a4c7/sqlc-dev/sqlc/issues/1157 |
| og:image:alt | Version 1.9.0 What happened? Support for nullable columns in joins were added in v1.9.0. Unfortunately, it appears this doesn't extend to the auto-generated enum types. As can be seen in the genera... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | johanbrandhorst |
| 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