Title: sqlc.slice() fails with 'column does not exist' error when used with subquery-computed column · Issue #3720 · sqlc-dev/sqlc · GitHub
Open Graph Title: sqlc.slice() fails with 'column does not exist' error when used with subquery-computed column · Issue #3720 · sqlc-dev/sqlc
X Title: sqlc.slice() fails with 'column does not exist' error when used with subquery-computed column · Issue #3720 · sqlc-dev/sqlc
Description: Version 1.27.0 What happened? When using sqlc.slice() with a column computed in a subquery, sqlc generate fails with a "column does not exist" error. This occurs even though the column is correctly defined and aliased in the subquery. Re...
Open Graph Description: Version 1.27.0 What happened? When using sqlc.slice() with a column computed in a subquery, sqlc generate fails with a "column does not exist" error. This occurs even though the column is correctly...
X Description: Version 1.27.0 What happened? When using sqlc.slice() with a column computed in a subquery, sqlc generate fails with a "column does not exist" error. This occurs even though the column is...
Opengraph URL: https://github.com/sqlc-dev/sqlc/issues/3720
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"sqlc.slice() fails with 'column does not exist' error when used with subquery-computed column","articleBody":"### Version\r\n\r\n1.27.0\r\n\r\n### What happened?\r\n\r\nWhen using sqlc.slice() with a column computed in a subquery, sqlc generate fails with a \"column does not exist\" error. This occurs even though the column is correctly defined and aliased in the subquery.\r\n\r\n### Relevant log output\r\n\r\n```shell\r\nquery.sql:18:3: 396: column \"full_name\" does not exist\r\n```\r\n\r\n\r\n### Database schema\r\n\r\n```sql\r\nCREATE TABLE customers (\r\n id INT UNSIGNED AUTO_INCREMENT PRIMARY KEY, \r\n first_name varchar(255) not null,\r\n last_name varchar(255) not null\r\n) ENGINE = INNODB DEFAULT CHARSET = utf8mb4;\r\n```\r\n\r\n\r\n### SQL queries\r\n\r\n```sql\r\n-- name: GetFullNames :many\r\nSELECT\r\n full_name\r\nFROM\r\n (\r\n SELECT\r\n \t concat(first_name, ' ', last_name) as full_name\r\n FROM\r\n customers\r\n ) subquery\r\nWHERE\r\n full_name IN (sqlc.slice (\"full_names\"));\r\n```\r\n\r\n\r\n### Configuration\r\n\r\n```\r\n{\r\n \"version\": \"2\",\r\n \"sql\": [\r\n {\r\n \"schema\": \"query.sql\",\r\n \"queries\": \"query.sql\",\r\n \"engine\": \"mysql\",\r\n \"gen\": {\r\n \"go\": {\r\n \"package\": \"db\",\r\n \"out\": \"db\"\r\n }\r\n }\r\n }\r\n ]\r\n}\r\n```\r\n\r\n### Playground URL\r\n\r\nhttps://play.sqlc.dev/p/043ded77492cec27dbba4e964774d08836ad76227a585856ae284f13f9046f24\r\n\r\n### What operating system are you using?\r\n\r\nmacOS\r\n\r\n### What database engines are you using?\r\n\r\nMySQL\r\n\r\n### What type of code are you generating?\r\n\r\nGo","author":{"url":"https://github.com/kawatakutaku","@type":"Person","name":"kawatakutaku"},"datePublished":"2024-11-23T03:37:47.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":1},"url":"https://github.com/3720/sqlc/issues/3720"}
| 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:9f8f3a08-f085-9643-c566-943c8bd42237 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | D194:322E35:89F9746:C26B413:6A50DAFA |
| html-safe-nonce | fd3e8b66c816ebe4a5ae5e7d994b2bbffa170ffc8798809e1203776155af2d19 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEMTk0OjMyMkUzNTo4OUY5NzQ2OkMyNkI0MTM6NkE1MERBRkEiLCJ2aXNpdG9yX2lkIjoiMjIzNTczMTU0MjgyMzk2NDEwIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | ba5a91a1af264b38d62cfc53d528b89c9cd9356a72535dbe9a4b46bd24c5c89b |
| hovercard-subject-tag | issue:2685231551 |
| 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/3720/issue_layout |
| twitter:image | https://opengraph.githubassets.com/7529cc8f7c4949547bdccc1d4234e60e394ec4a32847715342a030aac6e844ce/sqlc-dev/sqlc/issues/3720 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/7529cc8f7c4949547bdccc1d4234e60e394ec4a32847715342a030aac6e844ce/sqlc-dev/sqlc/issues/3720 |
| og:image:alt | Version 1.27.0 What happened? When using sqlc.slice() with a column computed in a subquery, sqlc generate fails with a "column does not exist" error. This occurs even though the column is correctly... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | kawatakutaku |
| hostname | github.com |
| expected-hostname | github.com |
| None | 72b13e0e8d0319acdd27a145cfe73f4f06c791713d0ac4690e41fb68ad28cac0 |
| 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 | 73ad5c4eaffed7bb3637024653eabdbca84a855e |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width