Bug Report
Please answer these questions before submitting your issue. Thanks!
- What did you do?
If possible, provide a recipe for reproducing the error.
package main
import (
"fmt"
"github.com/pingcap/parser"
"github.com/pingcap/parser/format"
_ "github.com/pingcap/tidb/types/parser_driver"
"strings"
)
func main() {
p := parser.New()
nodes, _ := p.ParseOneStmt(`
create table precise_types (
c DECIMAL(20,0) NOT NULL,
d DOUBLE(20,0) NOT NULL
);
`, "", "")
var s strings.Builder
ctx := format.NewRestoreCtx(format.DefaultRestoreFlags, &s)
nodes.Restore(ctx)
fmt.Println(s.String())
}
- What did you expect to see?
Prints
CREATE TABLE `precise_types` (`c` DECIMAL(20) NOT NULL,`d` DOUBLE(20,0) NOT NULL)
- What did you see instead?
The precision is just directly omitted.
CREATE TABLE `precise_types` (`c` DECIMAL NOT NULL,`d` DOUBLE NOT NULL)
- What version of TiDB SQL Parser are you using?
master (366172d)
Bug Report
Please answer these questions before submitting your issue. Thanks!
If possible, provide a recipe for reproducing the error.
Prints
The precision is just directly omitted.
master (366172d)