Title: Min/Max on Datetimes result in interface{} as type · Issue #1574 · sqlc-dev/sqlc · GitHub
Open Graph Title: Min/Max on Datetimes result in interface{} as type · Issue #1574 · sqlc-dev/sqlc
X Title: Min/Max on Datetimes result in interface{} as type · Issue #1574 · sqlc-dev/sqlc
Description: Version Other What happened? Hint: I am using v1.13.0 (installed via brew) but that is not available in the form. I currently have a query that looks like this: SELECT COUNT(*) as NumOfActivities, MIN(event_time) as MinDate, MAX(event_ti...
Open Graph Description: Version Other What happened? Hint: I am using v1.13.0 (installed via brew) but that is not available in the form. I currently have a query that looks like this: SELECT COUNT(*) as NumOfActivities, ...
X Description: Version Other What happened? Hint: I am using v1.13.0 (installed via brew) but that is not available in the form. I currently have a query that looks like this: SELECT COUNT(*) as NumOfActivities, ...
Opengraph URL: https://github.com/sqlc-dev/sqlc/issues/1574
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Min/Max on Datetimes result in interface{} as type","articleBody":"### Version\n\nOther\n\n### What happened?\n\nHint: I am using v1.13.0 (installed via brew) but that is not available in the form.\r\n\r\nI currently have a query that looks like this:\r\n```\r\nSELECT COUNT(*) as NumOfActivities,\r\n MIN(event_time) as MinDate, \r\n MAX(event_time) as MaxDate \r\nFROM activities \r\nWHERE account_id = $1\r\n```\r\nwhich creates a struct like this:\r\n```\r\ntype GetActivityMetaDataForAccountRow struct {\r\n\tNumofactivities int64\r\n\tMindate interface{}\r\n\tMaxdate interface{}\r\n}\r\n```\r\nbut I would expect\r\n```\r\ntype GetActivityMetaDataForAccountRow struct {\r\n\tNumofactivities int64\r\n\tMindate time.Time\r\n\tMaxdate time.Time\r\n}\r\n```\r\nso it looks like after putting a date through an aggregate-function sqlc can no longer determine its type? but it seems only to be the case for datetimes as far as I can see it.\n\n### Relevant log output\n\n_No response_\n\n### Database schema\n\n```sql\nCREATE TABLE activities (\r\n account_id BIGINT NOT NULL,\r\n event_time TIMESTAMP WITH TIME ZONE NOT NULL, \r\n);\n```\n\n\n### SQL queries\n\n```sql\nSELECT COUNT(*) as NumOfActivities,\r\n MIN(event_time) as MinDate, \r\n MAX(event_time) as MaxDate \r\nFROM activities \r\nWHERE account_id = $1\n```\n\n\n### Configuration\n\n_No response_\n\n### Playground URL\n\n_No response_\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/Neokil","@type":"Person","name":"Neokil"},"datePublished":"2022-04-27T14:52:46.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":14},"url":"https://github.com/1574/sqlc/issues/1574"}
| 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:c2d5a3a0-2cab-1042-c7c9-6100da309bee |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | C27A:7C22D:85FF9F:B44A2F:6A5056E6 |
| html-safe-nonce | 83c80618ac73d18773935b4f7820c96674ca7aad6f541c4f8d75eb024334e074 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDMjdBOjdDMjJEOjg1RkY5RjpCNDRBMkY6NkE1MDU2RTYiLCJ2aXNpdG9yX2lkIjoiNzY3NjI2OTkyMDM0NzI0ODM1OSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 237ef53606bea9ed8989f300305b3a03e8f6266e6be1f123788c3269e920b50a |
| hovercard-subject-tag | issue:1217474990 |
| 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/1574/issue_layout |
| twitter:image | https://opengraph.githubassets.com/34776829f567f6f1ec606cae92bbff5eeabde2010f20a16e1c1079269d77b8cc/sqlc-dev/sqlc/issues/1574 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/34776829f567f6f1ec606cae92bbff5eeabde2010f20a16e1c1079269d77b8cc/sqlc-dev/sqlc/issues/1574 |
| og:image:alt | Version Other What happened? Hint: I am using v1.13.0 (installed via brew) but that is not available in the form. I currently have a query that looks like this: SELECT COUNT(*) as NumOfActivities, ... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | Neokil |
| 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 | 7ac0ad2f2c7e4b9056617355fd9e33e22b0c8df9 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width