diff --git a/pkg/sql/opt/testutils/opttester/opt_tester.go b/pkg/sql/opt/testutils/opttester/opt_tester.go index e387c0279b83..24e83a894fe4 100644 --- a/pkg/sql/opt/testutils/opttester/opt_tester.go +++ b/pkg/sql/opt/testutils/opttester/opt_tester.go @@ -739,6 +739,9 @@ func (ot *OptTester) RunCommand(tb testing.TB, d *datadriven.TestData) string { case "expropt": e, err := ot.ExprOpt() if err != nil { + if len(errors.GetAllDetails(err)) > 0 { + return fmt.Sprintf("error: %s\ndetails:\n%s", err, errors.FlattenDetails(err)) + } return fmt.Sprintf("error: %s\n", err) } ot.postProcess(tb, d, e) diff --git a/pkg/sql/opt/xform/testdata/rules/cycle b/pkg/sql/opt/xform/testdata/rules/cycle index add3d9366e59..7d9645917447 100644 --- a/pkg/sql/opt/xform/testdata/rules/cycle +++ b/pkg/sql/opt/xform/testdata/rules/cycle @@ -16,3 +16,14 @@ expropt ) ---- error: memo group optimization passes surpassed limit of 100000; there may be a cycle in the memo +details: +memo (not optimized, ~3KB, required=[]) + ├── G1: (memo-cycle-test-rel G2 G3) (memo-cycle-test-rel G1 G3) + ├── G2: (scan ab,cols=(1,2)) (scan ab@ab_b_idx,cols=(1,2)) + │ └── [] + │ ├── best: (scan ab,cols=(1,2)) + │ └── cost: 1064.42 + ├── G3: (filters G4) + ├── G4: (eq G5 G6) + ├── G5: (variable b) + └── G6: (const 1)