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

From: Mahendra Singh Thalor <mahi6run(at)gmail(dot)com>
To: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Cc: Dilip Kumar <dilipbalaut(at)gmail(dot)com>, Andrew Dunstan <andrew(at)dunslane(dot)net>
Subject: getting "shell command argument contains a newline or carriage return:" error with pg_dumpall when db name have new line in double quote
Date: 2025-01-29 16:24:58
Message-ID: CAKYtNApkOi4FY0S7+3jpTqnHVyyZ6Tbzhtbah-NBbY-mGsiKAQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
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

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Melanie Plageman 2025-01-29 16:34:55 Re: Eagerly scan all-visible pages to amortize aggressive vacuum
Previous Message Nazir Bilal Yavuz 2025-01-29 15:24:45 Re: Windows CFBot is broken because ecpg dec_test.c error