Title: nullable jsonb failed to specify its struct · Issue #4030 · sqlc-dev/sqlc · GitHub
Open Graph Title: nullable jsonb failed to specify its struct · Issue #4030 · sqlc-dev/sqlc
X Title: nullable jsonb failed to specify its struct · Issue #4030 · sqlc-dev/sqlc
Description: Version 1.29.0 What happened? The doc https://docs.sqlc.dev/en/stable/reference/datatypes.html#json says that we can specify the struct to a jsonb, but I tried to make a easy demo of doc's code and failed. The generated model is type Boo...
Open Graph Description: Version 1.29.0 What happened? The doc https://docs.sqlc.dev/en/stable/reference/datatypes.html#json says that we can specify the struct to a jsonb, but I tried to make a easy demo of doc's code and...
X Description: Version 1.29.0 What happened? The doc https://docs.sqlc.dev/en/stable/reference/datatypes.html#json says that we can specify the struct to a jsonb, but I tried to make a easy demo of doc's code...
Opengraph URL: https://github.com/sqlc-dev/sqlc/issues/4030
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"nullable jsonb failed to specify its struct","articleBody":"### Version\n\n1.29.0\n\n### What happened?\n\nThe doc https://docs.sqlc.dev/en/stable/reference/datatypes.html#json says that we can specify the struct to a jsonb, but I tried to make a easy demo of doc's code and failed.\n\nThe generated model is\n```go\ntype Book struct {\n\tID int32\n\tData types.BookData\n}\n```\nbut the doc says that will be\n```go\ntype Book struct {\n Data *dto.BookData\n}\n```\n\nThis problem also happens in EditBookParams, I have provide the playground url: https://play.sqlc.dev/p/b1e8f0509a8d5c4e13f18db4b738040590eb1debc7439b4169314568d72e7742\n\n### Relevant log output\n\n```shell\n\n```\n\n### Database schema\n\n```sql\nCREATE TABLE books (\n id SERIAL PRIMARY KEY,\n data jsonb\n);\n```\n\n### SQL queries\n\n```sql\n-- name: GetBookById :one\nSELECT * FROM books\nWHERE id = @id LIMIT 1;\n```\n\n### Configuration\n\n```yaml\nversion: \"2\"\n\nsql:\n - engine: \"postgresql\"\n queries: \"query.sql\"\n schema: \"schema.sql\"\n gen:\n go:\n package: \"database\"\n out: \"database\"\n sql_package: pgx/v5\n\n emit_empty_slices: true\n emit_pointers_for_null_types: true\n\n overrides:\n - column: \"books.data\"\n go_type:\n import: \"sqlc-test/types\"\n package: \"types\"\n type: \"BookData\"\n```\n\n### Playground URL\n\nhttps://play.sqlc.dev/p/b1e8f0509a8d5c4e13f18db4b738040590eb1debc7439b4169314568d72e7742\n\n### What operating system are you using?\n\nWindows\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/bhscer","@type":"Person","name":"bhscer"},"datePublished":"2025-07-24T03:41:58.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":1},"url":"https://github.com/4030/sqlc/issues/4030"}
| 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:21a61304-f0df-4fb4-8d6a-dea84f6c863e |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | AB62:153E3D:B4AD04:F689ED:6A520918 |
| html-safe-nonce | 79af805d92f0559830873efa67cc3607618151ea1e4279b066921582abeadd50 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBQjYyOjE1M0UzRDpCNEFEMDQ6RjY4OUVEOjZBNTIwOTE4IiwidmlzaXRvcl9pZCI6IjMxMDU2ODczNDc3MDIwMjkwNCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 6f0f9e2cad42b0a8bec9f75cff3f9a3fe8d76f76e85fe7823cb1a314850ae67d |
| hovercard-subject-tag | issue:3258380050 |
| 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/4030/issue_layout |
| twitter:image | https://opengraph.githubassets.com/6984ebf7b2ae1e3b045c8c280e54fbe312c57d6667708d7d6911b86faaf57eb5/sqlc-dev/sqlc/issues/4030 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/6984ebf7b2ae1e3b045c8c280e54fbe312c57d6667708d7d6911b86faaf57eb5/sqlc-dev/sqlc/issues/4030 |
| og:image:alt | Version 1.29.0 What happened? The doc https://docs.sqlc.dev/en/stable/reference/datatypes.html#json says that we can specify the struct to a jsonb, but I tried to make a easy demo of doc's code and... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | bhscer |
| hostname | github.com |
| expected-hostname | github.com |
| None | b9a586c06a05a7a86fc7e3f4dbd03e42f6869085879aa184aa6369456dbd50fb |
| 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 | 7aed05249554b889eb33d002851a973eebcc7e91 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width