Table 9.31. to_char Examples

Started by PG Bug reporting form16 days ago3 messagesdocs
Jump to latest
#1PG Bug reporting form
noreply@postgresql.org

The following documentation comment has been logged on the website:

Page: https://www.postgresql.org/docs/18/functions-matching.html
Description:

This is not true:

```html
to_char(485, 'PL999') '+485'
```

add examples:

```psql
db=# SELECT quote_literal(to_char(timestamp '2026-04-15','RM'));
quote_literal
---------------
'IV '
(1 рядок)

db=# SELECT quote_literal(to_char(timestamp '2026-04-15','FMRM'));
quote_literal
---------------
'IV'
(1 рядок)

db=# SELECT quote_literal(to_char(timestamp '2026-12-31', 'rm'));
quote_literal
---------------
'xii '
(1 рядок)
```

#2David G. Johnston
david.g.johnston@gmail.com
In reply to: PG Bug reporting form (#1)
Re: Table 9.31. to_char Examples

On Monday, September 28, 2026, PG Doc comments form <noreply@postgresql.org>
wrote:

The following documentation comment has been logged on the website:

Page: https://www.postgresql.org/docs/18/functions-matching.html
Description:

This is not true:

```html
to_char(485, 'PL999') '+485'
```

You are correct. As a practical matter there will always be a space after
the plus sign since the formatting code seems to consumes two places. This
may arguably be a bug, but at this point we should just document the
behavior we have.

David J.

#3Daniel Gustafsson
daniel@yesql.se
In reply to: David G. Johnston (#2)
Re: Table 9.31. to_char Examples

On 28 Sep 2026, at 21:05, David G. Johnston <david.g.johnston@gmail.com> wrote:

This may arguably be a bug, but at this point we should just document the
behavior we have.

Agreed, pushed and backpatched all the way. The documentation has this output
down to 7.1 but I only tested down to 14.

--
Daniel Gustafsson