Ron <ronljohnsonjr@xxxxxxxxx> writes: > On 7/6/23 04:19, gzh wrote: >> when I execute the sql below , the to_char function caused the following >> error. >> select TO_CHAR('1000000'); > Isn't '1000000' already a character string? Nope; in the mind of the Postgres parser, it's a literal of unknown type, with the actual type to be inferred from context. There is a small preference for resolving such a thing as being of text type, but only a small one. The rules are exactly the same as for an undecorated NULL constant. regards, tom lane