9.4.1. format

Started by PG Bug reporting form2 days ago4 messagesdocs
Beta feature

Hackorum builds and tests every patch posted to the lists, not only commitfest submissions. This is Hackorum's own CI rather than the PostgreSQL project's, and it is still under testing - please report anything that looks wrong.

never appliedCI history
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-string.html
Description:

Here are some examples of the basic format conversions:

```html
SELECT format('INSERT INTO %I VALUES(%L)', 'locations', 'C:\Program Files');
Result: INSERT INTO locations VALUES('C:\Program Files')
```

```sql
db=# SELECT format('INSERT INTO %I VALUES(%L)', 'locations', 'C:\Program
Files');

format
----------------------------------------------------
INSERT INTO locations VALUES(E'C:\\Program Files')
```

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

On Saturday, September 19, 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-string.html
Description:

Here are some examples of the basic format conversions:

```html
SELECT format('INSERT INTO %I VALUES(%L)', 'locations', 'C:\Program
Files');
Result: INSERT INTO locations VALUES('C:\Program Files')
```

```sql
db=# SELECT format('INSERT INTO %I VALUES(%L)', 'locations', 'C:\Program
Files');

format
----------------------------------------------------
INSERT INTO locations VALUES(E'C:\\Program Files')
```

Indeed, the example doesn’t reflect the actual output since the presence of
a backslash prompts format to produce syntax for an escape string.

I don’t see a point for explaining when it may choose to write an escape
string but the examples should match reality. I’d back-patch this to
supported versions on that basis.

David J.

#3shihao zhong
zhong950419@gmail.com
In reply to: David G. Johnston (#2)
Re: 9.4.1. format

I don’t see a point for explaining when it may choose to write an escape
string but the examples should match reality.
I’d back-patch this to supported versions on that basis.

Agree with you, patch attached.
0001 is for master
0002 is for backport

Thanks,
Shihao

Attachments:

v1-0001-doc-fix-format-example-output-for-a-value-with-a-.patchapplication/octet-stream; name=v1-0001-doc-fix-format-example-output-for-a-value-with-a-.patchDownload+1-2
v1-0002-doc-fix-format-example-output-REL_14-to-REL_18.patchapplication/octet-stream; name=v1-0002-doc-fix-format-example-output-REL_14-to-REL_18.patchDownload+1-2
#4Daniel Gustafsson
daniel@yesql.se
In reply to: shihao zhong (#3)
Re: 9.4.1. format

On 20 Sep 2026, at 21:24, shihao zhong <zhong950419@gmail.com> wrote:

.. the examples should match reality.
I’d back-patch this to supported versions on that basis.

Agree with you, patch attached.

Agreed, I will apply once the current beta4 freeze is lifted.

--
Daniel Gustafsson