From: | PG Bug reporting form <noreply(at)postgresql(dot)org> |
---|---|
To: | pgsql-bugs(at)lists(dot)postgresql(dot)org |
Cc: | 798604270(at)qq(dot)com |
Subject: | BUG #18977: Unexpected result of function to_char |
Date: | 2025-07-03 13:23:12 |
Message-ID: | 18977-b301735f4ecad02f@postgresql.org |
Views: | Whole Thread | Raw Message | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
The following bug has been logged on the website:
Bug reference: 18977
Logged by: Chi Zhang
Email address: 798604270(at)qq(dot)com
PostgreSQL version: 18beta1
Operating system: ubuntu 24.04 with docker
Description:
hi,
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
From | Date | Subject | |
---|---|---|---|
Next Message | Laurenz Albe | 2025-07-03 13:27:05 | Re: BUG #18976: -0.0 with float8 will be transformed to 0 inprepare statement but not in normal execution |
Previous Message | ZhangChi | 2025-07-03 12:30:40 | Re: BUG #18976: -0.0 with float8 will be transformed to 0 inprepare statement but not in normal execution |