Skip to content

Commit d73dd77

Browse files
authored
Merge pull request #2683 from dolthub/jennifer/parser
use global parser for engine
2 parents c25ce0e + f2eb387 commit d73dd77

File tree

5 files changed

+4
-7
lines changed

5 files changed

+4
-7
lines changed

engine.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ func New(a *analyzer.Analyzer, cfg *Config) *Engine {
192192
PreparedDataCache: NewPreparedDataCache(),
193193
mu: &sync.Mutex{},
194194
EventScheduler: nil,
195-
Parser: sql.NewMysqlParser(),
195+
Parser: sql.GlobalParser,
196196
}
197197
ret.ReadOnly.Store(cfg.IsReadOnly)
198198
return ret

enginetest/queries/check_scripts.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,7 @@ CREATE TABLE t4
293293
Assertions: []ScriptTestAssertion{
294294
{
295295
Query: "ALTER TABLE test ADD CONSTRAINT bad_check CHECK (pk < 5)",
296-
ExpectedErr: plan.ErrCheckViolated,
296+
ExpectedErr: sql.ErrCheckConstraintViolated,
297297
},
298298
},
299299
},

sql/plan/alter_check.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,6 @@ import (
2828
var (
2929
// ErrNoCheckConstraintSupport is returned when the table does not support CONSTRAINT CHECK operations.
3030
ErrNoCheckConstraintSupport = errors.NewKind("the table does not support check constraint operations: %s")
31-
32-
// ErrCheckViolated is returned when the check constraint evaluates to false
33-
ErrCheckViolated = errors.NewKind("check constraint %s is violated.")
3431
)
3532

3633
type CreateCheck struct {

sql/planbuilder/from.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -826,7 +826,7 @@ func (b *Builder) resolveView(name string, database sql.Database, asOf interface
826826
b.ViewCtx().DbName = outerDb
827827
}()
828828
b.parserOpts = sql.NewSqlModeFromString(viewDef.SqlMode).ParserOptions()
829-
stmt, _, _, err := sql.GlobalParser.ParseWithOptions(b.ctx, viewDef.CreateViewStatement, ';', false, b.parserOpts)
829+
stmt, _, _, err := b.parser.ParseWithOptions(b.ctx, viewDef.CreateViewStatement, ';', false, b.parserOpts)
830830
if err != nil {
831831
b.handleErr(err)
832832
}

sql/rowexec/ddl_iters.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1804,7 +1804,7 @@ func (b *BaseBuilder) executeCreateCheck(ctx *sql.Context, c *plan.CreateCheck)
18041804
}
18051805

18061806
if sql.IsFalse(res) {
1807-
return plan.ErrCheckViolated.New(c.Check.Name)
1807+
return sql.ErrCheckConstraintViolated.New(c.Check.Name)
18081808
}
18091809
}
18101810

0 commit comments

Comments
 (0)