Re: function to_char(unknown) is not unique at character 8

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Ron <ronljohnsonjr(at)gmail(dot)com>
Cc: pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: function to_char(unknown) is not unique at character 8
Date: 2023-07-06 14:07:23
Message-ID: 1204404.1688652443@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Ron <ronljohnsonjr(at)gmail(dot)com> 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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message gzh 2023-07-06 14:15:54 Re: function to_char(unknown) is not unique at character 8
Previous Message Ron 2023-07-06 14:01:43 Re: function to_char(unknown) is not unique at character 8