4582: Fix panic when merging tables that have a check constraint with some string literal
This PR fixes a panic that occurs when merging tables that define a check constraint using some string literal. The panic's stacktrace is:
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x2 addr=0x10 pc=0x10193c7f8]
goroutine 1 [running]:
github.com/dolthub/go-mysql-server/sql/parse.convertVal(0x0?, 0x14000e80520)
/Users/dhruv/go/pkg/mod/github.com/dolthub/go-mysql-server@v0.12.1-0.20221018190947-3e6ea0fb9c2b/sql/parse/parse.go:3392 +0x658
github.com/dolthub/go-mysql-server/sql/parse.ExprToExpression(0x0, {0x10282ae00?, 0x14000e80520?})
/Users/dhruv/go/pkg/mod/github.com/dolthub/go-mysql-server@v0.12.1-0.20221018190947-3e6ea0fb9c2b/sql/parse/parse.go:3100 +0x1ee4
github.com/dolthub/go-mysql-server/sql/parse.comparisonExprToExpression(0x10281e901?, 0x14000e86c80)
/Users/dhruv/go/pkg/mod/github.com/dolthub/go-mysql-server@v0.12.1-0.20221018190947-3e6ea0fb9c2b/sql/parse/parse.go:3491 +0x54
github.com/dolthub/go-mysql-server/sql/parse.ExprToExpression(0x0, {0x10282ab00?, 0x14000e86c80?})
/Users/dhruv/go/pkg/mod/github.com/dolthub/go-mysql-server@v0.12.1-0.20221018190947-3e6ea0fb9c2b/sql/parse/parse.go:3089 +0x1cb8
github.com/dolthub/go-mysql-server/sql/parse.ExprToExpression(0x0, {0x10282ada0?, 0x14000200e70?})
/Users/dhruv/go/pkg/mod/github.com/dolthub/go-mysql-server@v0.12.1-0.20221018190947-3e6ea0fb9c2b/sql/parse/parse.go:3164 +0x1594
github.com/dolthub/go-mysql-server/sql/analyzer.ConvertCheckDefToConstraint(0x14000cbdf88?, 0x14000cbe288)
/Users/dhruv/go/pkg/mod/github.com/dolthub/go-mysql-server@v0.12.1-0.20221018190947-3e6ea0fb9c2b/sql/analyzer/check_constraints.go:317 +0xc4
github.com/dolthub/go-mysql-server.ColumnsFromCheckDefinition(0x10250f760?, 0x14000cbe3d0?)
/Users/dhruv/go/pkg/mod/github.com/dolthub/go-mysql-server@v0.12.1-0.20221018190947-3e6ea0fb9c2b/engine.go:583 +0x1c
github.com/dolthub/dolt/go/libraries/doltcore/merge.mergeChecks({0x102833588, 0x14000666e70}, {0x102833588, 0x14000667020}, {0x102833588, 0x14000667080})
/Users/dhruv/dolt/go/libraries/doltcore/merge/merge_schema.go:807 +0x31c
github.com/dolthub/dolt/go/libraries/doltcore/merge.SchemaMerge(0x1036fac40?, {0x10284f700, 0x1400065d920}, {0x10284f700, 0x1400065dc20}, {0x10284f700, 0x1400065dd40}, {0x1036fac40, 0x1})
/Users/dhruv/dolt/go/libraries/doltcore/merge/merge_schema.go:169 +0x5e0
github.com/dolthub/dolt/go/libraries/doltcore/merge.(*RootMerger).MergeTable(0x14000cbf0e0, {0x1028344d8, 0x14000e863c0}, {0x1036fac40, 0x1}, {0x0, {0x102824888, 0x140006611a0}, {0x1400066c6c0, 0x2c}}, ...)
/Users/dhruv/dolt/go/libraries/doltcore/merge/merge_rows.go:123 +0x1ec
github.com/dolthub/dolt/go/libraries/doltcore/merge.MergeRoots({0x1028344d8, 0x14000e863c0}, 0x1400067f1d0, 0x1400067f220, 0x1400067f3b0, {0x102824130, 0x14000e86500}, {0x102824130, 0x14000e86980}, {0x0, ...}, ...)
/Users/dhruv/dolt/go/libraries/doltcore/merge/merge.go:131 +0x62c
github.com/dolthub/dolt/go/libraries/doltcore/merge.MergeCommits({0x1028344d8, 0x14000e863c0}, 0x14000cbf3a8?, 0xb9ce7a80f36fd6ca?, {0x0, {0x102824888, 0x140006611a0}, {0x1400066c6c0, 0x2c}})
/Users/dhruv/dolt/go/libraries/doltcore/merge/merge.go:66 +0xf0
github.com/dolthub/dolt/go/libraries/doltcore/merge.ExecuteMerge({0x1028344d8, 0x14000e863c0}, 0x14000e863c0?, 0x14000eb6000)
/Users/dhruv/dolt/go/libraries/doltcore/merge/action.go:223 +0x9c
github.com/dolthub/dolt/go/cmd/dolt/commands.performMerge({0x1028344d8, 0x14000e863c0}, 0x14000eb6000?, 0x14000eb6000, {0x14000656280, 0x1e})
/Users/dhruv/dolt/go/cmd/dolt/commands/merge.go:497 +0xfc
github.com/dolthub/dolt/go/cmd/dolt/commands.MergeCmd.Exec({}, {0x1028344d8, 0x14000e863c0}, {0x14000668210, 0xa}, {0x1400004e1d0, 0x1, 0x1}, 0x1400066a090)
/Users/dhruv/dolt/go/cmd/dolt/commands/merge.go:184 +0x998
github.com/dolthub/dolt/go/cmd/dolt/cli.SubCommandHandler.handleCommand({{0x101e529aa, 0x4}, {0x101e6f2be, 0x11}, {0x0, 0x0}, {0x14000db6000, 0x2f, 0x2f}, 0x0}, ...)
/Users/dhruv/dolt/go/cmd/dolt/cli/command.go:237 +0x450
github.com/dolthub/dolt/go/cmd/dolt/cli.SubCommandHandler.Exec({{0x101e529aa, 0x4}, {0x101e6f2be, 0x11}, {0x0, 0x0}, {0x14000db6000, 0x2f, 0x2f}, 0x0}, ...)
/Users/dhruv/dolt/go/cmd/dolt/cli/command.go:186 +0x390
main.runMain()
/Users/dhruv/dolt/go/cmd/dolt/dolt.go:395 +0x6ec
main.main()
/Users/dhruv/dolt/go/cmd/dolt/dolt.go:140 +0x1c