Skip to content

Commit c43dfa9

Browse files
authored
Merge pull request #2697 from dolthub/jennifer/domain
expose planbuilder methods for domain support in Doltgres
2 parents 63ed221 + 925130e commit c43dfa9

File tree

3 files changed

+21
-3
lines changed

3 files changed

+21
-3
lines changed

sql/constraints.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,8 @@ func (f *ForeignKeyConstraint) DebugString() string {
7676

7777
type ForeignKeyConstraints []*ForeignKeyConstraint
7878

79-
// CheckDefinition defines a trigger. Integrators are not expected to parse or understand the trigger definitions,
80-
// but must store and return them when asked.
79+
// CheckDefinition defines a check constraint. Integrators are not expected to parse or
80+
// understand the check constraint definitions, but must store and return them when asked.
8181
type CheckDefinition struct {
8282
Name string // The name of this check. Check names in a database are unique.
8383
CheckExpression string // String serialization of the check expression

sql/plan/common.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ func IsBinary(node sql.Node) bool {
3030
return len(node.Children()) == 2
3131
}
3232

33-
// NillaryNode is a node with no children. This is a common WithChildren implementation for all nodes that have none.
33+
// NillaryWithChildren is a node with no children. This is a common WithChildren implementation for all nodes that have none.
3434
func NillaryWithChildren(node sql.Node, children ...sql.Node) (sql.Node, error) {
3535
if len(children) != 0 {
3636
return nil, sql.ErrInvalidChildrenNumber.New(node, len(children), 0)

sql/planbuilder/builder.go

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -439,3 +439,21 @@ func assignColumnIndexes(e sql.Expression, schema sql.Schema) sql.Expression {
439439
})
440440
return e
441441
}
442+
443+
// Below methods are used in Doltgres. TODO: maybe find way to not expose these methods
444+
445+
func (b *Builder) BuildScalarWithTable(expr ast.Expr, tableExpr ast.TableExpr) sql.Expression {
446+
outscope := b.newScope()
447+
if tableExpr != nil {
448+
outscope = b.buildDataSource(outscope, tableExpr)
449+
}
450+
return b.buildScalar(outscope, expr)
451+
}
452+
453+
func (b *Builder) BuildColumnDefaultValueWithTable(defExpr ast.Expr, tableExpr ast.TableExpr, typ sql.Type, nullable bool) *sql.ColumnDefaultValue {
454+
outscope := b.newScope()
455+
if tableExpr != nil {
456+
outscope = b.buildDataSource(outscope, tableExpr)
457+
}
458+
return b.convertDefaultExpression(outscope, defExpr, typ, nullable)
459+
}

0 commit comments

Comments
 (0)