8000 dolt FixedWidthTableWriter panic when calling stored proc · Issue #5317 · dolthub/dolt · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
dolt FixedWidthTableWriter panic when calling stored proc #5317
Closed
@PavelSafronov

Description

@PavelSafronov

Note: this reproduces against dolt CLI, but not when running the repo's engine tests, since those do not exercise FixedWidthTableWriter.

SQL:

use db;

CREATE TABLE t(a INT, b INT);

DELIMITER $
CREATE PROCEDURE populate(counterMax INT) BEGIN
    DECLARE counter INT DEFAULT 0;
    WHILE counter < counterMax DO
        SET counter = counter + 1;
        INSERT INTO t(a, b) VALUES (counter, counter);
        -- SELECT counter;
    END WHILE;
END$
DELIMITER ;

CALL populate(10);
SELECT COUNT(*) FROM t;

MySQL execution (mysql -u root -e "$SQL"):

+----------+
| COUNT(*) |
+----------+
|       10 |
+----------+

dolt execution with default formatter (dolt sql -q "$SQL"):

database storage format: NEW ( __DOLT__ )
Database changed
panic: runtime error: index out of range [0] with length 0

goroutine 1 [running]:
github.com/dolthub/dolt/go/libraries/doltcore/table/untyped/tabular.(*FixedWidthTableWriter).stringValue(0x10?, 0x1041c4f40?, {0x102837040?, 0x1400115fee0?})
        github.com/dolthub/dolt/go/libraries/doltcore/table/untyped/tabular/fixedwidth_tablewriter.go:229 +0x7c
github.com/dolthub/dolt/go/libraries/doltcore/table/untyped/tabular.(*FixedWidthTableWriter).sampleRow(0x14000b568c0, {0x1400013cf80, 0x1, 0x1?}, {0x14000010250, 0x1, 0x1})
        github.com/dolthub/dolt/go/libraries/doltcore/table/untyped/tabular/fixedwidth_tablewriter.go:177 +0xc4
github.com/dolthub/dolt/go/libraries/doltcore/table/untyped/tabular.(*FixedWidthTableWriter).WriteColoredRow(0x14000b568c0, {0x0?, 0x1400135f018?}, {0x1400013cf80, 0x1, 0x1}, {0x0?, 0x0?, 0x0?})
        github.com/dolthub/dolt/go/libraries/doltcore/table/untyped/tabular/fixedwidth_tablewriter.go:143 +0xa0
github.com/dolthub/dolt/go/libraries/doltcore/table/untyped/tabular.(*FixedWidthTableWriter).WriteSqlRow(0x140005b3d60?, {0x102a2db28?, 0x14000f3e6e0?}, {0x1400013cf80?, 0x14000f41300?, 0x64?})
        github.com/dolthub/dolt/go/libraries/doltcore/table/untyped/tabular/fixedwidth_tablewriter.go:130 +0x34
github.com/dolthub/dolt/go/cmd/dolt/commands/engine.writeResultSet(0x0?, {0x102a1fb68, 0x140005b3d60}, {0x102a1ea38, 0x14000b568c0})
        github.com/dolthub/dolt/go/cmd/dolt/commands/engine/sql_print.go:158 +0xe8
github.com/dolthub/dolt/go/cmd/dolt/commands/engine.prettyPrintResultsWithSummary(0x14000f3e6e0, 0x0, {0x0?, 0x0, 0x0}, {0x102a1fb68, 0x140005b3d60}, 0x0)
        github.com/dolthub/dolt/go/cmd/dolt/commands/engine/sql_print.go:101 +0x37c
github.com/dolthub/dolt/go/cmd/dolt/commands/engine.PrettyPrintResults(...)
        github.com/dolthub/dolt/go/cmd/dolt/commands/engine/sql_print.go:55
github.com/dolthub/dolt/go/cmd/dolt/commands.runMultiStatementMode(0x14000f3c140?, 0x140002c6f30, {0x102a17760?, 0x140000a84e0}, 0x0)
        github.com/dolthub/dolt/go/cmd/dolt/commands/sql.go:840 +0x5ec
github.com/dolthub/dolt/go/cmd/dolt/commands.execMultiStatements({0x102a2d380, 0x14000200750}, 0x8d?, 0x8?, {0x102a17760, 0x140000a84e0}, 0x1?, 0x1400135f708)
        github.com/dolthub/dolt/go/cmd/dolt/commands/sql.go:586 +0x168
github.com/dolthub/dolt/go/cmd/dolt/commands.queryMode({0x102a2d380, 0x14000200750}, 0x101fc51dd?, 0x5?, 0x140002bb050, {0x16f2b33cc, 0x169}, 0x2?, 0x1400135f488?, 0x1400135f708)
        github.com/dolthub/dolt/go/cmd/dolt/commands/sql.go:450 +0x1f0
github.com/dolthub/dolt/go/cmd/dolt/commands.SqlCmd.Exec({{0x101fc77fd?, 0x101b0fcfc?}}, {0x102a2d380, 0x14000200750}, {0x140005fa1e0, 0x8}, {0x1400004e0a0, 0x2, 0x2}, 0x1400011c090)
        github.com/dolthub/dolt/go/cmd/dolt/commands/sql.go:303 +0xedc
github.com/dolthub/dolt/go/cmd/dolt/cli.SubCommandHandler.handleCommand({{0x101fc3653, 0x4}, {0x101fde27d, 0x11}, {0x0, 0x0}, {0x14000202900, 0x2f, 0x2f}, 0x0}, ...)
        github.com/dolthub/dolt/go/cmd/dolt/cli/command.go:237 +0x450
github.com/dolthub/dolt/go/cmd/dolt/cli.SubCommandHandler.Exec({{0x101fc3653, 0x4}, {0x101fde27d, 0x11}, {0x0, 0x0}, {0x14000202900, 0x2f, 0x2f}, 0x0}, ...)
        github.com/dolthub/dolt/go/cmd/dolt/cli/command.go:186 +0x390
main.runMain()
        github.com/dolthub/dolt/go/cmd/dolt/dolt.go:393 +0x6dc
main.main()
        github.com/dolthub/dolt/go/cmd/dolt/dolt.go:139 +0x1c

dolt execution with JSON formatter (dolt sql -q "$SQL" -r json):

Database changed
{"rows": [{},{},{},{},{},{},{},{},{},{}]}
{"rows": [{"COUNT(*)":10}]}

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingpanic

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0