Title: pgx transaction example improvements · Issue #3808 · sqlc-dev/sqlc · GitHub
Open Graph Title: pgx transaction example improvements · Issue #3808 · sqlc-dev/sqlc
X Title: pgx transaction example improvements · Issue #3808 · sqlc-dev/sqlc
Description: Version 1.28.0 What happened? The example for how to do transactions with pgx added in #3557 will always run Rollback. The rollback will return an error which appears silent, but isn't if pgx is wrapped in opentelemetry tracing. Instead ...
Open Graph Description: Version 1.28.0 What happened? The example for how to do transactions with pgx added in #3557 will always run Rollback. The rollback will return an error which appears silent, but isn't if pgx is wr...
X Description: Version 1.28.0 What happened? The example for how to do transactions with pgx added in #3557 will always run Rollback. The rollback will return an error which appears silent, but isn't if pgx i...
Opengraph URL: https://github.com/sqlc-dev/sqlc/issues/3808
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"pgx transaction example improvements","articleBody":"### Version\n\n1.28.0\n\n### What happened?\n\nThe example for how to do transactions with pgx added in #3557 will always run `Rollback`. The rollback will return an error which appears silent, but isn't if pgx is wrapped in opentelemetry tracing.\n\nInstead of always doing a Rollback I believe you can make a `context.WithCancel` context and then `defer cancel()` will rollback the transaction if it's not already committed.\n\n### Relevant log output\n\n```shell\n\n```\n\n### Database schema\n\n```sql\n\n```\n\n### SQL queries\n\n```sql\n\n```\n\n### Configuration\n\n```yaml\n\n```\n\n### Playground URL\n\n_No response_\n\n### What operating system are you using?\n\n_No response_\n\n### What database engines are you using?\n\n_No response_\n\n### What type of code are you generating?\n\n_No response_","author":{"url":"https://github.com/abh","@type":"Person","name":"abh"},"datePublished":"2025-01-25T07:48:38.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":2},"url":"https://github.com/3808/sqlc/issues/3808"}
| 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:1ed187c1-32a9-1ae6-1e7a-288386e3061f |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | DA20:4950B:69CD8C8:941FFE1:6A5049F7 |
| html-safe-nonce | b5b641f0ba90380a4764f0a6844ebe8277fb1c36c6a01355cefb9d873a6a1bf9 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEQTIwOjQ5NTBCOjY5Q0Q4Qzg6OTQxRkZFMTo2QTUwNDlGNyIsInZpc2l0b3JfaWQiOiIxMzUzMDIzOTg5NzYxNDYwNzI3IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | d9ee87f63264ca09e056d0518e000b67770fbf448a503f7509d24e3fce559e1c |
| hovercard-subject-tag | issue:2810833815 |
| 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/3808/issue_layout |
| twitter:image | https://opengraph.githubassets.com/1130be564bb0aa8c937408ceb8a18fc62ef4cf3412f3bcc7d159032e5ce8c588/sqlc-dev/sqlc/issues/3808 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/1130be564bb0aa8c937408ceb8a18fc62ef4cf3412f3bcc7d159032e5ce8c588/sqlc-dev/sqlc/issues/3808 |
| og:image:alt | Version 1.28.0 What happened? The example for how to do transactions with pgx added in #3557 will always run Rollback. The rollback will return an error which appears silent, but isn't if pgx is wr... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | abh |
| 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