@@ -23,29 +23,8 @@ import (
2323 "github.com/dolthub/go-mysql-server/sql/types"
2424)
2525
26- // Resolving column defaults is a multi-phase process, with different analyzer rules for each phase.
27- //
28- // - parseColumnDefaults: Some integrators (dolt but not GMS) store their column defaults as strings, which we need to
29- // parse into expressions before we can analyze them any further.
30- // - resolveColumnDefaults: Once we have an expression for a default value, it may contain expressions that need
31- // simplification before further phases of processing can take place.
32- //
33- // After this stage, expressions in column default values are handled by the normal analyzer machinery responsible for
34- // resolving expressions, including things like columns and functions. Every node that needs to do this for its default
35- // values implements `sql.Expressioner` to expose such expressions. There is custom logic in `resolveColumns` to help
36- // identify the correct indexes for column references, which can vary based on the node type.
37- //
38- // Finally there are cleanup phases:
39- // - validateColumnDefaults: ensures that newly created column defaults from a DDL statement are legal for the type of
40- // column, various other business logic checks to match MySQL's logic.
41- // - stripTableNamesFromDefault: column defaults headed for storage or serialization in a query result need the table
42- // names in any GetField expressions stripped out so that they serialize to strings without such table names. Table
43- // names in GetField expressions are expected in much of the rest of the analyzer, so we do this after the bulk of
44- // analyzer work.
45- //
46- // The `information_schema.columns` table also needs access to the default values of every column in the database, and
47- // because it's a table it can't implement `sql.Expressioner` like other node types. Instead it has special handling
48- // here, as well as in the `resolve_functions` rule.
26+ // validateColumnDefaults ensures that newly created column defaults from a DDL statement are legal for the type of
27+ // column, various other business logic checks to match MySQL's logic.
4928func validateColumnDefaults (ctx * sql.Context , _ * Analyzer , n sql.Node , _ * plan.Scope , _ RuleSelector , qFlags * sql.QueryFlags ) (sql.Node , transform.TreeIdentity , error ) {
5029 span , ctx := ctx .Span ("validateColumnDefaults" )
5130 defer span .End ()
0 commit comments