Description
Due to Subquery Expression there is issue with decoding prepared plan and object resolution.
repro for single node.
replace encoded_plan in 3rd curl from 1st curl
curl -v http://localhost:8093/query/service -d 'statement=prepare p2 from SELECT META(default).id FROM default USE KEYS (SELECT RAW META(s).id FROM default s USE KEYS["k01"]);' |
curl -v http://localhost:8093/query/service -d 'statement=delete from system:prepareds where name = "p2";' |
curl -v http://localhost:8093/query/service -H "Content-Type: application/json" -d '{"prepared":"p2","encoded_plan": "H4sIAAAAAAAA/6SR0WrbTBCFX2U5/40MIvzJTWF7ZYoCJQk1kUspiYkGaWJvslptZ1ep06A+e1lnXRP3rgWB2OGbmTPnvIBdO3Tc3XlLDhoo4ahnaPgzlBg8C8VBoF/w3+GBmr+N7FpGiZ/txthO2EHfvIXmY9wMYn4kyot5MpbXHNKoSxPiDl+SrDlCo+N7Gm3U+Y8SCzFP0O+m1bTf8VciLvi5bsmhxCM/B2gUgS23UQl9V0XPkYomNLOTxnTNTN3L0Ksmi2gUBdWERo2BVepWN7d4/P/0FqsZpvLtnnOO7SZv8dTy4aZs6XH1eMCChKxlixI9bfcvE3ro039y4KMz0ZBdyPDAbVIjHEYb7yJLH3Y0b30Csxv767MnSAkc3WrcYd60mtJ3hNRRmPpdL4JZO4qjcJJvOmg8hMFhKhF5m8L3wp6ElT97DUDV1WX1YamuquW8yHJmJ6ZT59efrlQuqM91pS6qr7UqMn49//LaEv6Ew2/8kOF7TL8CAAD//99IJKsAAwAA", "creds":[{"user":"Administrator","pass":"password"}]}' |
request text:
prepare p2 from SELECT META(default).id FROM default USE KEYS (SELECT RAW META(s).id FROM default s USE KEYS["k01"]);
stack:
goroutine 375 [running]:
github.com/couchbase/query/execution.(*Context).Recover(0xc420094000)
/Users/sitaram/master/query/src/github.com/couchbase/query/execution/context.go:477 +0xbc
panic(0x49466c0, 0x50fbdb0)
/usr/local/Cellar/go/1.8.3/libexec/src/runtime/panic.go:489 +0x2cf
github.com/couchbase/query/expression.(*Identifier).Evaluate(0xc42063d900, 0x0, 0x0, 0x5095c00, 0xc420094000, 0x402b64f, 0xc420027eb8, 0x4624c71, 0x200001)
/Users/sitaram/master/query/src/github.com/couchbase/query/expression/identifier.go:48 +0x2b
github.com/couchbase/query/execution.(*ExpressionScan).RunOnce.func1()
/Users/sitaram/master/query/src/github.com/couchbase/query/execution/scan_expression.go:52 +0x16a
sync.(*Once).Do(0xc42083e650, 0xc420027f88)
/usr/local/Cellar/go/1.8.3/libexec/src/sync/once.go:44 +0xbe
github.com/couchbase/query/execution.(*ExpressionScan).RunOnce(0xc42083e600, 0xc420094000, 0x0, 0x0)
/Users/sitaram/master/query/src/github.com/couchbase/query/execution/scan_expression.go:79 +0x9b
created by github.com/couchbase/query/execution.(*base).runConsumer.func1
/Users/sitaram/master/query/src/github.com/couchbase/query/execution/base.go:245 +0x487