Re: Trailing semicolons in psql patch - Mailing list pgsql-patches

From greg@turnstep.com
Subject Re: Trailing semicolons in psql patch
Date
Msg-id 3BB8AA89.10486.1B1CCD7@localhost
Whole thread Raw
In response to Re: Trailing semicolons in psql patch  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Trailing semicolons in psql patch  (Bruce Momjian <pgman@candle.pha.pa.us>)
List 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@turnstep.com PGP Key: 0x14964AC8 200110011738

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

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


pgsql-patches by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: Patch for pl/tcl Tcl_ExternalToUtf and Tcl_UtfToExternal
Next
From: Bruce Momjian
Date:
Subject: Re: CREATE OR REPLACE FUNCTION