Title: sqlc not accepting go type overrides for timestamp with timezone on postgres · Issue #3815 · sqlc-dev/sqlc · GitHub
Open Graph Title: sqlc not accepting go type overrides for timestamp with timezone on postgres · Issue #3815 · sqlc-dev/sqlc
X Title: sqlc not accepting go type overrides for timestamp with timezone on postgres · Issue #3815 · sqlc-dev/sqlc
Description: Version 1.28.0 What happened? Sqlc doesn't generate models based on the type overrides found in the configuration sqlc.yaml. It doesn't accept the go type override for time.Time when the postgres type in the schema is a timestamp with ti...
Open Graph Description: Version 1.28.0 What happened? Sqlc doesn't generate models based on the type overrides found in the configuration sqlc.yaml. It doesn't accept the go type override for time.Time when the postgres t...
X Description: Version 1.28.0 What happened? Sqlc doesn't generate models based on the type overrides found in the configuration sqlc.yaml. It doesn't accept the go type override for time.Time when the po...
Opengraph URL: https://github.com/sqlc-dev/sqlc/issues/3815
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"sqlc not accepting go type overrides for timestamp with timezone on postgres","articleBody":"### Version\n\n1.28.0\n\n### What happened?\n\nSqlc doesn't generate models based on the type overrides found in the configuration `sqlc.yaml`. It doesn't accept the go type override for time.Time when the postgres type in the schema is a `timestamp with time zone`, but accepts it when the postgres type is defined using the short hand `timestamptz`.\n\n\n### Relevant log output\n\n```shell\n\n```\n\n### Database schema\n\n```sql\n-- doesn't work for this table as the generated model has a created_at pgtype.Timestamptz field\nCREATE TABLE test (\n id serial,\n created_at timestamp with time zone not null\n);\n-- works for this table as the generated model has a created_at time.Time field\nCREATE TABLE test2 (\n id serial,\n created_at timestamptz not null \n);\n```\n\n### SQL queries\n\n```sql\n\n```\n\n### Configuration\n\n```yaml\nversion: \"2\"\nsql:\n - engine: \"postgresql\"\n schema: \"./database/schema.sql\"\n queries: \"./database/query\"\n gen:\n go:\n emit_json_tags: true\n package: \"bloc\"\n out: \"database/sqlc/bloc\"\n sql_package: \"pgx/v5\"\n overrides:\n # Override PostgreSQL \"timestamptz\" to Go's time.Time\n # Doesn't work if the `db_type` is replaced with timestamp with time zone either\n - db_type: \"timestamptz\"\n go_type: \"time.Time\"\n```\n\n### Playground URL\n\nhttps://play.sqlc.dev/p/2b3c34a2cbb6b39c97097dd41b5dba87ac45eeeae192be8e0e40e225405d6527\n\n### What operating system are you using?\n\nmacOS\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/Kerod-Fresenbet-Gebremedhin2660","@type":"Person","name":"Kerod-Fresenbet-Gebremedhin2660"},"datePublished":"2025-02-01T07:58:16.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":1},"url":"https://github.com/3815/sqlc/issues/3815"}
| 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:b85c7060-e84e-c5da-fb27-ac7180af3f28 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 8456:11B239:26A7045:3516076:6A504D79 |
| html-safe-nonce | 7360fb964eb3c5eff84596efac9fdff836fb4d607599f994e1c0cdf642f24909 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4NDU2OjExQjIzOToyNkE3MDQ1OjM1MTYwNzY6NkE1MDRENzkiLCJ2aXNpdG9yX2lkIjoiODk2MTk3NzY5NjE4ODkxMDk2OSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | b2ec8fba033402dc442d5b818dec8ee3e63cba3171262ce87def16be8db31ed5 |
| hovercard-subject-tag | issue:2825054311 |
| 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/3815/issue_layout |
| twitter:image | https://opengraph.githubassets.com/d6b3a991836a3de856e29f8fdb8f7cfdd08537800a80e7687a20cef99c99f6c9/sqlc-dev/sqlc/issues/3815 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/d6b3a991836a3de856e29f8fdb8f7cfdd08537800a80e7687a20cef99c99f6c9/sqlc-dev/sqlc/issues/3815 |
| og:image:alt | Version 1.28.0 What happened? Sqlc doesn't generate models based on the type overrides found in the configuration sqlc.yaml. It doesn't accept the go type override for time.Time when the postgres t... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | Kerod-Fresenbet-Gebremedhin2660 |
| hostname | github.com |
| expected-hostname | github.com |
| None | d6dc8294eb500fa36bbc57472d61fe87c522f9c3c1d64f70f4926f66a66a7efb |
| 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 | 5741a45fe07e5f377d0d4c524a92e3056acc51bb |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width