diff --git a/go/cmd/dolt/commands/sql.go b/go/cmd/dolt/commands/sql.go old mode 100644 new mode 100755 index 23a122785b..3c75544f3b --- a/go/cmd/dolt/commands/sql.go +++ b/go/cmd/dolt/commands/sql.go @@ -19,6 +19,7 @@ import ( "bytes" "context" "fmt" + "github.com/liquidata-inc/dolt/go/libraries/utils/osutil" "io" "os" "path/filepath" @@ -117,9 +118,12 @@ func Sql(commandStr string, args []string, dEnv *env.DoltEnv) int { } // Run in either batch mode for piped input, or shell mode for interactive - fi, _ := os.Stdin.Stat() - if (fi.Mode() & os.ModeCharDevice) == 0 { + fi, err := os.Stdin.Stat() + // Windows has a bug where STDIN can't be statted in some cases, see https://github.com/golang/go/issues/33570 + if (err != nil && osutil.IsWindows) || (fi.Mode() & os.ModeCharDevice) == 0 { root = runBatchMode(dEnv, root) + } else if err != nil { + HandleVErrAndExitCode(errhand.BuildDError("Couldn't stat STDIN. This is a bug.").Build(), usage) } else { var err error root, err = runShell(dEnv, root) diff --git a/go/libraries/doltcore/sql/sqlddl.go b/go/libraries/doltcore/sql/sqlddl.go old mode 100644 new mode 100755 index a35e45e3df..ae1c8b21f3 --- a/go/libraries/doltcore/sql/sqlddl.go +++ b/go/libraries/doltcore/sql/sqlddl.go @@ -451,6 +451,8 @@ func getColumn(colDef *sqlparser.ColumnDefinition, indexes []*sqlparser.IndexDef return schema.InvalidCol, nil, err } + // TODO: type conversion. This doesn't work at all for uint columns (parser always thinks integer literals are int, + // not uint) if getter.NomsKind != colKind { return errColumn("Type mismatch for default value of column %v: '%v'", column.Name, nodeToString(colDef.Type.Default)) } diff --git a/samples/ip2nation/ip2nation.sql b/samples/ip2nation/ip2nation.sql index 028e97f091..4180ebd12a 100644 --- a/samples/ip2nation/ip2nation.sql +++ b/samples/ip2nation/ip2nation.sql @@ -1,6 +1,6 @@ CREATE TABLE ip2nation ( - ip int(11) unsigned NOT NULL default '0', + ip int(11) NOT NULL default 0, country char(2) NOT NULL default '', PRIMARY KEY (ip) ); @@ -11,8 +11,8 @@ CREATE TABLE ip2nationCountries ( iso_code_3 varchar(3) default '', iso_country varchar(255) NOT NULL default '', country varchar(255) NOT NULL default '', - lat float NOT NULL default '0', - lon float NOT NULL default '0', + lat float NOT NULL default 0.0, + lon float NOT NULL default 0.0, PRIMARY KEY (code) );