Title: sqlc crashes when calling a function with OUT arg · Issue #1654 · sqlc-dev/sqlc · GitHub
Open Graph Title: sqlc crashes when calling a function with OUT arg · Issue #1654 · sqlc-dev/sqlc
X Title: sqlc crashes when calling a function with OUT arg · Issue #1654 · sqlc-dev/sqlc
Description: Version 1.13.0 What happened? I tried to call a function which has an OUT argument. I am seeing sqlc crash a lot when I try to do this. I realize I might have botched the syntax or something somewhat, but the crash is making diagnosis of...
Open Graph Description: Version 1.13.0 What happened? I tried to call a function which has an OUT argument. I am seeing sqlc crash a lot when I try to do this. I realize I might have botched the syntax or something somewh...
X Description: Version 1.13.0 What happened? I tried to call a function which has an OUT argument. I am seeing sqlc crash a lot when I try to do this. I realize I might have botched the syntax or something somewh...
Opengraph URL: https://github.com/sqlc-dev/sqlc/issues/1654
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"sqlc crashes when calling a function with OUT arg","articleBody":"### Version\r\n\r\n1.13.0\r\n\r\n### What happened?\r\n\r\nI tried to call a function which has an OUT argument. I am seeing sqlc crash a lot when I try to do this. I realize I might have botched the syntax or something somewhat, but the crash is making diagnosis of the problem harder.\r\n\r\n### Relevant log output\r\n\r\n```shell\r\nsqlc generate failed.\r\n\r\npanic: runtime error: invalid memory address or nil pointer dereference\r\n[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0xe77599]\r\n\r\ngoroutine 1 [running]:\r\ngithub.com/kyleconroy/sqlc/internal/compiler.sourceTables(0xc00051f0a0, {0x14205a0, 0xc00037dd90})\r\n\t/go/pkg/mod/github.com/kyleconroy/sqlc@v1.13.0/internal/compiler/output_columns.go:409 +0x639\r\ngithub.com/kyleconroy/sqlc/internal/compiler.outputColumns(0xc00051f0a0, {0x14205a0, 0xc00037dd90})\r\n\t/go/pkg/mod/github.com/kyleconroy/sqlc@v1.13.0/internal/compiler/output_columns.go:54 +0x56\r\ngithub.com/kyleconroy/sqlc/internal/compiler.(*Compiler).parseQuery(0xc000424000, {0x1420340, 0xc0002159a0}, {0xc000418480, 0x21a}, {0x0, {0x0, 0x0, {0x0, 0x0}}})\r\n\t/go/pkg/mod/github.com/kyleconroy/sqlc@v1.13.0/internal/compiler/parse.go:114 +0x8bf\r\ngithub.com/kyleconroy/sqlc/internal/compiler.(*Compiler).parseQueries(0xc000424000, {0x20, {0x20, 0x45, {0x0, 0x1}}})\r\n\t/go/pkg/mod/github.com/kyleconroy/sqlc@v1.13.0/internal/compiler/compile.go:108 +0x513\r\ngithub.com/kyleconroy/sqlc/internal/compiler.(*Compiler).ParseQueries(...)\r\n\t/go/pkg/mod/github.com/kyleconroy/sqlc@v1.13.0/internal/compiler/engine.go:49\r\ngithub.com/kyleconroy/sqlc/internal/cmd.parse({_, _}, {_, _}, {_, _}, {_, _}, {{0xc0002294a6, 0xa}, ...}, ...)\r\n\t/go/pkg/mod/github.com/kyleconroy/sqlc@v1.13.0/internal/cmd/generate.go:262 +0x253\r\ngithub.com/kyleconroy/sqlc/internal/cmd.Generate({0x14343d0, 0xc00004e040}, {0x80, 0x46}, {0xc00004a3c0, 0x57}, {0x0, 0x101e900}, {0x14250e0, 0xc000010020})\r\n\t/go/pkg/mod/github.com/kyleconroy/sqlc@v1.13.0/internal/cmd/generate.go:183 +0x7bb\r\ngithub.com/kyleconroy/sqlc/internal/cmd.glob..func3(0x1d3bcc0, {0x116a2e3, 0x0, 0x0})\r\n\t/go/pkg/mod/github.com/kyleconroy/sqlc@v1.13.0/internal/cmd/cmd.go:144 +0x194\r\ngithub.com/spf13/cobra.(*Command).execute(0x1d3bcc0, {0x2366b60, 0x0, 0x0})\r\n\t/go/pkg/mod/github.com/spf13/cobra@v1.4.0/command.go:860 +0x5f8\r\ngithub.com/spf13/cobra.(*Command).ExecuteC(0xc0002fea00)\r\n\t/go/pkg/mod/github.com/spf13/cobra@v1.4.0/command.go:974 +0x3bc\r\ngithub.com/spf13/cobra.(*Command).Execute(...)\r\n\t/go/pkg/mod/github.com/spf13/cobra@v1.4.0/command.go:902\r\ngithub.com/spf13/cobra.(*Command).ExecuteContext(...)\r\n\t/go/pkg/mod/github.com/spf13/cobra@v1.4.0/command.go:895\r\ngithub.com/kyleconroy/sqlc/internal/cmd.Do({0xc00003c050, 0x1, 0x1}, {0x14250a0, 0xc000010010}, {0x14250e0, 0xc000010018}, {0x14250e0, 0xc000010020})\r\n\t/go/pkg/mod/github.com/kyleconroy/sqlc@v1.13.0/internal/cmd/cmd.go:47 +0x4ba\r\nmain.main()\r\n\t/go/pkg/mod/github.com/kyleconroy/sqlc@v1.13.0/cmd/sqlc/main.go:10 +0x7a\r\n```\r\n\r\n\r\n### Database schema\r\n\r\n```sql\r\n-- Example queries for sqlc\r\nCREATE TABLE authors (\r\n id BIGSERIAL PRIMARY KEY,\r\n name text NOT NULL,\r\n bio text\r\n);\r\n\r\nCREATE OR REPLACE FUNCTION add_author (name text, bio text, out id int)\r\nAS $$\r\nDECLARE\r\nBEGIN\r\n id = 123;\r\nEND;\r\n$$ LANGUAGE plpgsql;\r\n```\r\n\r\n\r\n### SQL queries\r\n\r\n```sql\r\n-- name: CreateAuthor :one\r\nSELECT * FROM add_author (\r\n sqlc.arg(name), sqlc.arg(bio)\r\n);\r\n```\r\n\r\n\r\n### Configuration\r\n\r\n```yaml\r\n{\r\n \"version\": \"1\",\r\n \"packages\": [\r\n {\r\n \"path\": \"db\",\r\n \"engine\": \"postgresql\",\r\n \"schema\": \"query.sql\",\r\n \"queries\": \"query.sql\"\r\n }\r\n ]\r\n}\r\n```\r\n\r\n\r\n### Playground URL\r\n\r\nhttps://play.sqlc.dev/p/a6294fc50b0b186b26f9ff70895aefec3fc9f2e19390bcf81e91021aacde0231\r\n\r\n### What operating system are you using?\r\n\r\nLinux\r\n\r\n### What database engines are you using?\r\n\r\nPostgreSQL\r\n\r\n### What type of code are you generating?\r\n\r\nGo","author":{"url":"https://github.com/danielbprice","@type":"Person","name":"danielbprice"},"datePublished":"2022-05-31T17:07:59.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":4},"url":"https://github.com/1654/sqlc/issues/1654"}
| 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:67e7f74c-7db9-3fb2-2e66-7866c1a07f53 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 8B4C:20A2E2:27B898:355171:6A51BA71 |
| html-safe-nonce | e122878c47bf8f924c581672a6556d86c2c164c65a36ebbe950a74af1ddf56c0 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4QjRDOjIwQTJFMjoyN0I4OTg6MzU1MTcxOjZBNTFCQTcxIiwidmlzaXRvcl9pZCI6IjQ5NTYxMzEwMDI4MDIwOTI2NTciLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 351ad8e0fb2c38cc05ca184b9ddbbaa5b07fa0f34f01abda80b47cddb0fb96d6 |
| hovercard-subject-tag | issue:1254155298 |
| 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/1654/issue_layout |
| twitter:image | https://opengraph.githubassets.com/8ee2f45e94a5287acb5a56eb32a8a624a54926c6c75fbf20df1cf48b5d89719d/sqlc-dev/sqlc/issues/1654 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/8ee2f45e94a5287acb5a56eb32a8a624a54926c6c75fbf20df1cf48b5d89719d/sqlc-dev/sqlc/issues/1654 |
| og:image:alt | Version 1.13.0 What happened? I tried to call a function which has an OUT argument. I am seeing sqlc crash a lot when I try to do this. I realize I might have botched the syntax or something somewh... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | danielbprice |
| 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