Re: BUG #18977: Unexpected result of function to_char

From: Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>
To: 798604270(at)qq(dot)com, pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #18977: Unexpected result of function to_char
Date: 2025-07-03 14:40:53
Message-ID: 491f5530291b01cab08cfaa1d3b590fd1b3465b6.camel@cybertec.at
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Thu, 2025-07-03 at 13:23 +0000, PG Bug reporting form wrote:
> the following two queries are equivalent but return different results:
> ```
> SELECT ((to_char(-1E30, '0.9930824')));
> to_char
> ------------
> -#.##3#824
> (1 row)
> PREPARE prepare_query (float8) AS SELECT ((to_char($1, '0.9930824')));
> EXECUTE prepare_query(-1E30::float8);
> to_char
> ---------
> -#.
> ```
> furthermore, it seems the second argument of to_chat is formatted, but
> according to the document in
> https://www.postgresql.org/docs/current/functions-formatting.html, it should
> be the first argument to be formatted

This is the same as bug report #18976.
For user guidance, please write to the pgsql-general mailing list.
This list is for bug reports.

Yours,
Laurenz Albe

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Fujii Masao 2025-07-03 14:42:16 Re: BUG #16931: source code problem about commit_ts
Previous Message ZhangChi 2025-07-03 13:45:20 Re: BUG #18976: -0.0 with float8 will be transformed to 0 inpreparestatement but not in normal execution