Format implements the Datum interface.
(ctx *FmtCtx)
| 3606 | |
| 3607 | // Format implements the Datum interface. |
| 3608 | func (d *DOid) Format(ctx *FmtCtx) { |
| 3609 | if d.semanticType.Oid() == oid.T_oid || d.name == "" { |
| 3610 | // If we call FormatNode directly when the disambiguateDatumTypes flag |
| 3611 | // is set, then we get something like 123:::INT:::OID. This is the |
| 3612 | // important flag set by FmtParsable which is supposed to be |
| 3613 | // roundtrippable. Since in this branch, a DOid is a thin wrapper around |
| 3614 | // a DInt, I _think_ it's correct to just delegate to the DInt's Format. |
| 3615 | d.DInt.Format(ctx) |
| 3616 | } else if ctx.HasFlags(fmtDisambiguateDatumTypes) { |
| 3617 | ctx.WriteString("crdb_internal.create_") |
| 3618 | ctx.WriteString(d.semanticType.SQLStandardName()) |
| 3619 | ctx.WriteByte('(') |
| 3620 | d.DInt.Format(ctx) |
| 3621 | ctx.WriteByte(',') |
| 3622 | lex.EncodeSQLStringWithFlags(&ctx.Buffer, d.name, lex.EncNoFlags) |
| 3623 | ctx.WriteByte(')') |
| 3624 | } else { |
| 3625 | // This is used to print the name of pseudo-procedures in e.g. |
| 3626 | // pg_catalog.pg_type.typinput |
| 3627 | lex.EncodeSQLStringWithFlags(&ctx.Buffer, d.name, lex.EncBareStrings) |
| 3628 | } |
| 3629 | } |
| 3630 | |
| 3631 | // IsMax implements the Datum interface. |
| 3632 | func (d *DOid) IsMax(ctx *EvalContext) bool { return d.DInt.IsMax(ctx) } |
nothing calls this directly
no test coverage detected