Re: getting "shell command argument contains a newline or carriage return:" error with pg_dumpall when db name have new line in double quote

Andrew Dunstan <andrew@dunslane.net>

From: Andrew Dunstan <andrew@dunslane.net>
To: Srinath Reddy <srinath2133@gmail.com>, Mahendra Singh Thalor <mahi6run@gmail.com>
Cc: pgsql-hackers@lists.postgresql.org
Date: 2025-03-26T12:25:15Z
Lists: pgsql-hackers
On 2025-03-26 We 3:04 AM, Srinath Reddy wrote:
>
> I have reviewed all solutions but based on the commit message and 
> comments, it is clear that the goal is to *entirely forbid database 
> names containing carriage return (CR) or line feed (LF)* characters. 
> *Solution 1 LGTM and aligns with this approach* by enforcing the 
> restriction at the time of database creation, ensuring consistency 
> throughout PostgreSQL. This approach eliminates ambiguity and 
> guarantees that such database names *cannot be created or dumped with 
> CR or LF.*
>
> To validate this behavior, I have also implemented a *TAP test* for 
> Solution 1.
>

You can still create a database with these using "CREATE DATABASE" 
though. Shouldn't we should really be preventing that?


cheers


andrew

--
Andrew Dunstan
EDB:https://www.enterprisedb.com

Commits

Same data as JSON: GET /api/v1/messages/:b64id/commits the thread's linked commits as JSON, with link sources. API reference →
  1. Disallow CR and LF in database, role, and tablespace names