Re: pg_dump option to dump only functions

From: "Sean Utt" <sean(at)strateja(dot)com>
To: "Andrew Dunstan" <andrew(at)dunslane(dot)net>
Cc: <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: pg_dump option to dump only functions
Date: 2005-10-30 23:24:50
Message-ID: 009201c5dda9$1fe6fb50$0201a8c0@randomnoise
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Thanks! Any reason the comment shouldn't also mention this directly? I.E.:
/*
This covers the long options equivalent to -X xxx.
The -X options return 0 if called in long form, because then we store a flag
rather than returning a distinct value.
See man 3 getopt.
*/

Sean

----- Original Message -----
From: "Andrew Dunstan" <andrew(at)dunslane(dot)net>
To: "Sean Utt" <sean(at)strateja(dot)com>
Cc: <pgsql-hackers(at)postgresql(dot)org>
Sent: Sunday, October 30, 2005 3:05 PM
Subject: Re: [HACKERS] pg_dump option to dump only functions

>
> You have omitted the "case 0" line following the comment, which is in fact
> what it refers to. The -X options return 0 if called in long form, because
> then we store a flag rather than returning a distinct value. See man 3
> getopt.
>
> cheers
>
> andrew
>
> Sean Utt wrote:
>
>> In what might be called my spare time, I was looking at pg_dump.c to see
>> about adding an option to dump only functions, and I think a comment got
>> pushed out of place in the section for handling arguments:
>>
>> 395 case 'X':
>> 396 if (strcmp(optarg,
>> "disable-dollar-quoting") == 0)
>> 397 disable_dollar_quoting =
>> 1;
>> 398 else if (strcmp(optarg,
>> "disable-triggers") == 0)
>> 399 disable_triggers = 1;
>> 400 else if (strcmp(optarg,
>> "use-set-session-authorization") == 0)
>> 401 use_setsessauth = 1;
>> 402 else
>> 403 {
>> 404 fprintf(stderr,
>> 405 _("%s:
>> invalid -X option -- %s\n"),
>> 406 progname,
>> optarg);
>> 407 fprintf(stderr, _("Try
>> \"%s --help\" for more information.\n"), progname );
>> 408 exit(1);
>> 409 }
>> 410 break;
>> 411
>> 412 case 'Z': /*
>> Compression Level */
>> 413 compressLevel = atoi(optarg);
>> 414 break;
>> 415 /* This covers the long options
>> equivalent to -X xxx. */
>> ^^^^^^^^^^^^^^^^ --------------
>> This comment seems out of place here. I imagine it once was after the
>> break for case: 'X': (line411) and got misplaced when case 'Z': was
>> added. Any other fantasies about how it got here, or where it belongs?
>>
>> My other fantasy is that it was supposed to go here:
>> 241 /*
>> 242 * the following options don't have an equivalent
>> short option letter,
>> 243 * but are available as '-X long-name'
>> 244 */
>> 245 {"disable-dollar-quoting", no_argument,
>> &disable_dollar_quoting, 1},
>> 246 {"disable-triggers", no_argument,
>> &disable_triggers, 1},
>> 247 {"use-set-session-authorization", no_argument,
>> &use_setsessauth, 1},
>> on line 248.....
>>
>> I am not sure where it should go, but it seems pretty out of place where
>> it is.
>>
>> Sean
>>
>>
>>
>>
>> ---------------------------(end of broadcast)---------------------------
>> TIP 2: Don't 'kill -9' the postmaster
>>
>
>

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Josh Berkus 2005-10-31 00:49:29 Re: add_missing_from breaks existing views
Previous Message Tom Lane 2005-10-30 23:22:18 Re: add_missing_from breaks existing views