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

Mahendra Singh Thalor <mahi6run@gmail.com>

From: Mahendra Singh Thalor <mahi6run@gmail.com>
To: PostgreSQL-development <pgsql-hackers@postgresql.org>
Cc: Dilip Kumar <dilipbalaut@gmail.com>, Andrew Dunstan <andrew@dunslane.net>
Date: 2025-01-29T16:24:58Z
Lists: pgsql-hackers
Hi,
While doing some testing with pg_dumpall, I noticed one weird behaviour.

While we create the database, we are allowing the database name with a new
line (if name is in double quote).
*For example*:

> postgres=# create database "dbstr1;
> dbstr 2";
> CREATE DATABASE
> postgres=#

Here, the database name is in 2 lines.

With the help of pg_dumpall, I tried to dump but I am getting an error for
the new line.

--
> -- Database "dbstr1;
> dbstr 2" dump
> --
>
> shell command argument contains a newline or carriage return: "
> dbname='dbstr1;
> dbstr 2'"
>

After this message, we are stopping the dump.

I think, if we are allowing new lines in the db name, then we should dump
it.

Please let me know your thoughts about this error.

-- 
Thanks and Regards
Mahendra Singh Thalor
EnterpriseDB: http://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