MCPcopy Create free account
hub / github.com/cockroachdb/cockroachdb-parser / formatSummaryInsert

Method formatSummaryInsert

pkg/sql/sem/tree/format.go:737–755  ·  view source on GitHub ↗

formatSummaryInsert pretty-prints a summarized insert/upsert statement. See FmtSummary for supported formats.

(node *Insert)

Source from the content-addressed store, hash-verified

735// formatSummaryInsert pretty-prints a summarized insert/upsert statement.
736// See FmtSummary for supported formats.
737func (ctx *FmtCtx) formatSummaryInsert(node *Insert) {
738 if node.OnConflict.IsUpsertAlias() {
739 ctx.WriteString("UPSERT")
740 } else {
741 ctx.WriteString("INSERT")
742 }
743 ctx.WriteString(" INTO ")
744 ctx.formatLimitLength(node.Table, TableLimit)
745 rows := node.Rows
746 expr := rows.Select
747 if _, ok := expr.(*SelectClause); ok {
748 ctx.WriteByte(' ')
749 ctx.formatNodeSummary(rows)
750 } else if node.Columns != nil {
751 ctx.WriteByte('(')
752 ctx.formatLimitLength(&node.Columns, ColumnLimit)
753 ctx.WriteByte(')')
754 }
755}
756
757// formatSummaryUpdate pretty-prints a summarized update statement.
758// See FmtSummary for supported formats.

Callers 1

formatNodeSummaryMethod · 0.95

Calls 3

formatLimitLengthMethod · 0.95
formatNodeSummaryMethod · 0.95
IsUpsertAliasMethod · 0.80

Tested by

no test coverage detected