Re: BUG #18977: Unexpected result of function to_char - Mailing list pgsql-bugs

From Laurenz Albe
Subject Re: BUG #18977: Unexpected result of function to_char
Date
Msg-id 491f5530291b01cab08cfaa1d3b590fd1b3465b6.camel@cybertec.at
Whole thread Raw
In response to BUG #18977: Unexpected result of function to_char  (PG Bug reporting form <noreply@postgresql.org>)
List 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



pgsql-bugs by date:

Previous
From: "ZhangChi"
Date:
Subject: Re: BUG #18976: -0.0 with float8 will be transformed to 0 inpreparestatement but not in normal execution
Next
From: Fujii Masao
Date:
Subject: Re: BUG #16931: source code problem about commit_ts