Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion go/mysql/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -432,7 +432,9 @@ func (l *Listener) handle(ctx context.Context, conn net.Conn, connectionID uint3
defer c.discardCursor()

// First build and send the server handshake packet.
serverAuthPluginData, err := c.writeHandshakeV10(l.ServerVersion, l.authServer, l.TLSConfig != nil)
// Advertise SSL capability if TLS is configured OR if secure transport is required
enableTLS := l.TLSConfig != nil || l.RequireSecureTransport
serverAuthPluginData, err := c.writeHandshakeV10(l.ServerVersion, l.authServer, enableTLS)
if err != nil {
if err != io.EOF {
l.handleConnectionError(c, fmt.Sprintf("Cannot send HandshakeV10 packet: %v", err))
Expand Down
34 changes: 28 additions & 6 deletions go/vt/sqlparser/ast.go
Original file line number Diff line number Diff line change
Expand Up @@ -7758,16 +7758,37 @@ type TableFuncExpr struct {
Name string
Alias TableIdent
Exprs SelectExprs
// Columns are optional column aliases for the result columns.
// This is a Doltgres extension, not used by MySQL.
Columns Columns
// WithOrdinality when true, adds an ordinality column to the result.
// This is a Doltgres extension, not used by MySQL.
WithOrdinality bool
}

// Format formats the node.
func (node TableFuncExpr) Format(buf *TrackedBuffer) {
if node.Alias.IsEmpty() {
if node.Name != "" {
buf.Myprintf("%s(%v)", node.Name, node.Exprs)
} else {
buf.Myprintf("%s(%v) %s %v", node.Name, node.Exprs, keywordStrings[AS], node.Alias)
buf.Myprintf("ROWS FROM(%v)", node.Exprs)
}
if node.WithOrdinality {
buf.Myprintf(" WITH ORDINALITY")
}
if !node.Alias.IsEmpty() {
buf.Myprintf(" %s %v", keywordStrings[AS], node.Alias)
if len(node.Columns) > 0 {
buf.Myprintf("(")
for i, col := range node.Columns {
if i > 0 {
buf.Myprintf(", ")
}
buf.Myprintf("%v", col)
}
buf.Myprintf(")")
}
}

}

// IsEmpty returns true if TableFuncExpr's name is empty.
Expand Down Expand Up @@ -7809,9 +7830,10 @@ func (node *TableFuncExpr) walkSubtree(visit Visit) error {
if node == nil {
return nil
}
return Walk(
visit,
node.Exprs)
if err := Walk(visit, node.Exprs); err != nil {
return err
}
return node.Columns.walkSubtree(visit)
}

// TableIdent is a case sensitive SQL identifier. It will be escaped with
Expand Down