Re: Trailing semicolons in psql patch

From: greg(at)turnstep(dot)com
To: pgsql-patches(at)postgresql(dot)org
Subject: Re: Trailing semicolons in psql patch
Date: 2001-10-01 21:40:25
Message-ID: 3BB8AA89.10486.1B1CCD7@localhost
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-patches

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

> I agree with this premise ... but stated that way, the patch does
> entirely the wrong thing, because it's stripping trailing semis at
> the word level not the line level. I think it's a lot more surprising
> to drop the semi in
>
> \x foo; bar
>
> than when it's actually at the end of the line.

Ah...so what we want then is for all of these cases to work:

\d foo \d bar
\d foo; \d bar
\d foo; \d bar;
\d foo; \d bar

Makes sense...I never combine backslash commands on the same line,
but it is possible. In that case, how about just moving this section:

if (semicolon) {
int i;
for (i = strlen(options_string)-1; i && options_string[i]==';'; i--);
if (i<strlen(options_string)-1) options_string[i+1]='\0';
}

to right after here, where we find a "normal word"?

strncpy(return_val, &options_string[pos], token_end);
return_val[token_end] = 0;

(and changing options_string to return_val)

that should allow us to catch all the cases above, if I am
understanding the objection above correctly.

Greg Sabino Mullane
greg(at)turnstep(dot)com PGP Key: 0x14964AC8 200110011738

-----BEGIN PGP SIGNATURE-----
Comment: http://www.turnstep.com/pgp.html

iQA/AwUBO7jijLybkGcUlkrIEQIMWwCfYDNNqC/UYKKKaqj5MYrEcg2bGhcAoPUP
cqeF4yXAuPedUpQPLVFsw1lO
=4dGu
-----END PGP SIGNATURE-----

In response to

Responses

Browse pgsql-patches by date

  From Date Subject
Next Message Bruce Momjian 2001-10-02 22:37:02 Re: CREATE OR REPLACE FUNCTION
Previous Message Bruce Momjian 2001-10-01 15:34:32 Re: Patch for pl/tcl Tcl_ExternalToUtf and Tcl_UtfToExternal