MCPcopy Create free account
hub / github.com/dolthub/doltgresql / Format

Method Format

postgres/parser/sem/tree/table_name.go:191–213  ·  view source on GitHub ↗

Format implements the NodeFormatter interface.

(ctx *FmtCtx)

Source from the content-addressed store, hash-verified

189
190// Format implements the NodeFormatter interface.
191func (n *TableIndexName) Format(ctx *FmtCtx) {
192 if n.Index == "" {
193 ctx.FormatNode(&n.Table)
194 return
195 }
196
197 if n.Table.ObjectName != "" {
198 // The table is specified.
199 ctx.FormatNode(&n.Table)
200 ctx.WriteByte('@')
201 ctx.FormatNode(&n.Index)
202 return
203 }
204
205 // The table is not specified. The schema/catalog can still be specified.
206 if n.Table.ExplicitSchema || ctx.alwaysFormatTablePrefix() {
207 ctx.FormatNode(&n.Table.ObjectNamePrefix)
208 ctx.WriteByte('.')
209 }
210 // In this case, we must format the index name as a restricted name (quotes
211 // must be added for reserved keywords).
212 ctx.FormatNode((*Name)(&n.Index))
213}
214
215func (n *TableIndexName) String() string { return AsString(n) }
216

Callers

nothing calls this directly

Calls 2

FormatNodeMethod · 0.80

Tested by

no test coverage detected