Re: TIL: In pg_dump, beware the combo of "-Fd" and "-Z"

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Ron <ronljohnsonjr(at)gmail(dot)com>
Cc: pgsql-admin(at)lists(dot)postgresql(dot)org
Subject: Re: TIL: In pg_dump, beware the combo of "-Fd" and "-Z"
Date: 2021-01-20 20:27:18
Message-ID: 784982.1611174438@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

Ron <ronljohnsonjr(at)gmail(dot)com> writes:
> On 1/19/21 10:54 PM, Adrian Ho wrote:
>> A quick look at the `pg_dump` source code indicates that:
>>
>> * `-Z` requires an argument, and
>>
>> * the argument is converted to an integer with the `atoi()` C function
>>
>> This means that `-Z` actually took `-v` as its argument, which `atoi()`
>> converts to integer 0. That explains what you saw, and I'm also guessing
>> you did NOT get verbose output from your second command.

> That's right.

Using atoi or siblings without any error checking is not unusual in our
programs (or lots of others, I imagine). I recall some past discussion
of tightening up parsing of integer arguments to complain if they
didn't look like integers. But evidently nobody's pushed that forward.

regards, tom lane

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message Michel SALAIS 2021-01-22 07:57:25 RE: Data Type to store Leading Zero(0)
Previous Message Holger Jakobs 2021-01-20 16:03:26 Re: standby compatibility matrix