Re: getting "shell command argument contains a newline or carriage return:" error with pg_dumpall when db name have new line in double quote
Nathan Bossart <nathandbossart@gmail.com>
From: Nathan Bossart <nathandbossart@gmail.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Álvaro Herrera <alvherre@alvh.no-ip.org>, Andrew Dunstan <andrew@dunslane.net>, Mahendra Singh Thalor <mahi6run@gmail.com>, Srinath Reddy <srinath2133@gmail.com>, pgsql-hackers@lists.postgresql.org
Date: 2026-02-02T20:52:43Z
Lists: pgsql-hackers
On Mon, Feb 02, 2026 at 09:14:28AM -0500, Tom Lane wrote: > =?utf-8?Q?=C3=81lvaro?= Herrera <alvherre@alvh.no-ip.org> writes: >> This is not an objection to this patch, but I don't see why we should >> allow newlines in tablespace names if we're going to restrict them in >> names of roles and databases. Is it only because pg_dumpall happens not >> to dump a comment with the tablespace name on it, like we do for dbs and >> roles? Sounds unprincipled. >> I think keeping these things under the same rules makes the most sense. > > Yeah, I was thinking the same. A while back, I did a bit of testing with a patch that disallowed line feeds and carriage returns in all names by adding a check to namein, namerecv, and namestrcpy. I'm not sure exactly why I stopped, but that seemed to work relatively well, although it is a quite large hammer. I also recall seeing this thread from 2016 [0], which I don't think has been cited here. In any case, even if this change goes through, we'll need to teach applications like pg_dump to either 1) verify there are no names with \n\r or 2) handle them appropriately for all supported server versions. IMHO (2) is quite fragile. [0] https://postgr.es/m/flat/CAB7nPqRbDwmrZW-W6QW6AwiL1WoZJO4XJ-b1%2B_O4xyy67zn%3DFw%40mail.gmail.com -- nathan
Commits
Same data as JSON:
GET /api/v1/messages/:b64id/commits
the thread's linked commits as JSON, with link sources.
API reference →
-
Disallow CR and LF in database, role, and tablespace names
- b380a56a3f95 19 (unreleased) landed
-
Switch the regression tests of pg_upgrade to use TAP tests
- 322becb6085c 15.0 cited