Skip to content

Return subquery errors instead of panicking on unnest into query - #7715

Closed
jay23606 wants to merge 1 commit into
superdb:mainfrom
jay23606:pr-go/7396-panic-on-unnest-expr-into-query-with-non
Closed

jay23606 wants to merge 1 commit into
superdb:mainfrom
jay23606:pr-go/7396-panic-on-unnest-expr-into-query-with-non

Conversation

@jay23606

Copy link
Copy Markdown

Bug

unnest [1] into (from "http://127.0.0.1:1/x" (format json)) panicked when the source could not be reached (#7396). The compile-time path in compileVamSubquery already returned errors, but the callback that re-creates a subquery instance for re-entrant evaluation still called panic(err), and the first compile also panicked on the same error class.

Change

  • runtime/op/subquery.go: NewSubquery now takes a create callback that returns (*Subquery, error). Subquery.Eval returns the error as an error value when it cannot create a duplicate instance, instead of panicking.
  • compiler/rungen/vexpr.go: the re-creation callback passes the error through; the panic is removed.
  • runtime/ztests/expr/subquery-into-connect-error.yaml: regression test. It checks that super fails with the error text and does not panic. It matches the stable prefix http://127.0.0.1:1/x: Get "...": dial tcp 127.0.0.1:1: so it does not depend on the OS-specific connect message (Windows reports a different string).

Testing

  • go build ./runtime/op/ ./compiler/... && go vet ./runtime/op/ ./compiler/rungen/ passes.
  • The regression test passes on this fix and fails on the parent commit with panic: http://127.0.0.1:1/x: Get ..., as the issue describes.
  • The re-creation path is not covered by a dedicated test. Reaching it needs a re-entrant subquery whose source fails only on a later instance, which I did not construct.

Regression test: fails on base twice (/panic: http://127\.0\.0\.1:1/x/), passes on fix twice (mkdir -p .pr-go/bin && go build -o .pr-go/bin/super ./cmd/super && ZTEST_PATH="$PWD/.pr-go/bin" go test . -short -run 'TestSPQ/runtime/ztests/expr/subquery-into-connect-error')

Fixes #7396

@philrz

philrz commented Nov 25, 2026

Copy link
Copy Markdown
Contributor

@jay23606: Thanks for the PR. We're going to close it, since we plan to fix #7396 ourselves.

For future contributions, please see the Pull requests section of our contributing guide. We ask that a maintainer agree to a change and its approach, on Slack or in an issue, before a PR is opened. If you use an AI agent, it should follow our AGENTS.md. And if this bug is getting in the way of something you're doing with SuperDB, we'd like to hear about your use case in #7396 or on Slack.

@philrz philrz closed this Nov 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Panic on "unnest <expr> into ( <query> )" with non-listening URL

2 participants