From: | Srinath Reddy <srinath2133(at)gmail(dot)com> |
---|---|
To: | Mahendra Singh Thalor <mahi6run(at)gmail(dot)com> |
Cc: | pgsql-hackers(at)lists(dot)postgresql(dot)org |
Subject: | Re: 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-30 11:17:17 |
Message-ID: | CAFC+b6qwc+wpt7_b2R6YhpDkrXeFvFd5NoLbTMMoxX9tfOHjpg@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Wed, Jan 29, 2025 at 9:55 PM Mahendra Singh Thalor <mahi6run(at)gmail(dot)com>
wrote:
> 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 have reproduced and verified the same.The reason is in runPgDump during
appendShellString for forming the pg_dump command , in
appendShellStringNoError we are considering the string as invalid if it has
'\n' and '\r'.
>
> I think, if we are allowing new lines in the db name, then we should dump
> it.
>
Agreed.
Regards,
Srinath Reddy Sadipiralla,
EDB: https://www.enterprisedb.com <http://www.enterprisedb.com/>
From | Date | Subject | |
---|---|---|---|
Next Message | Oliver Ford | 2025-01-30 12:02:19 | Re: Add RESPECT/IGNORE NULLS and FROM FIRST/LAST options |
Previous Message | Ilia Evdokimov | 2025-01-30 10:58:47 | Re: Sample rate added to pg_stat_statements |