Обсуждение: Not to to confusing

Поиск
Список
Период
Сортировка

Not to to confusing

От
"Greg Sabino Mullane"
Дата:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1


Quick patch to adress a recent concern on the mailing list
about adding an errant "TO" when we already have a TO. Since
TO cannot be a valid column name (we must quote it), we can
simply ignore the tab-completion if the previous word
was a "TO"

- --
Greg Sabino Mullane greg@turnstep.com
PGP Key: 0x14964AC8 200504112303
http://biglumber.com/x/web?pk=2529DF6AB8F79407E94445B4BC9B906714964AC8

Index: tab-complete.c
===================================================================
RCS file: /projects/cvsroot/pgsql/src/bin/psql/tab-complete.c,v
retrieving revision 1.124
diff -c -r1.124 tab-complete.c
*** tab-complete.c      7 Apr 2005 01:51:39 -0000       1.124
- --- tab-complete.c    11 Apr 2005 16:17:07 -0000
***************
*** 820,826 ****

        /* ALTER TABLE xxx RENAME yyy */
        else if (pg_strcasecmp(prev4_wd, "TABLE") == 0 &&
!                        pg_strcasecmp(prev2_wd, "RENAME") == 0)
                COMPLETE_WITH_CONST("TO");

        /* If we have TABLE <sth> DROP, provide COLUMN or CONSTRAINT */
- --- 820,827 ----

        /* ALTER TABLE xxx RENAME yyy */
        else if (pg_strcasecmp(prev4_wd, "TABLE") == 0 &&
!                        pg_strcasecmp(prev2_wd, "RENAME") == 0 &&
!                                        pg_strcasecmp(prev_wd, "TO"))
                COMPLETE_WITH_CONST("TO");

        /* If we have TABLE <sth> DROP, provide COLUMN or CONSTRAINT */

-----BEGIN PGP SIGNATURE-----

iD8DBQFCWzrJvJuQZxSWSsgRAlWgAJ9HkwLfDTkLngWvQQH0qXspAHZSgACgrZvj
sjqcPohL54+0eDSlUQDQADc=
=iyxJ
-----END PGP SIGNATURE-----



Re: Not to to confusing

От
Tom Lane
Дата:
"Greg Sabino Mullane" <greg@turnstep.com> writes:
>         else if (pg_strcasecmp(prev4_wd, "TABLE") == 0 &&
> !                        pg_strcasecmp(prev2_wd, "RENAME") == 0 &&
> !                                        pg_strcasecmp(prev_wd, "TO"))
>                 COMPLETE_WITH_CONST("TO");

In order to be somewhat consistent and not too confusing, could we
spell that as 'pg_strcasecmp(prev_wd, "TO") != 0' please?

(See previous rant about the undesirability of pretending that
integers are booleans...)

            regards, tom lane

Re: Not to to confusing

От
Bruce Momjian
Дата:
Patch applied, with adjustment recommended by Tom.

> In order to be somewhat consistent and not too confusing, could we
> spell that as 'pg_strcasecmp(prev_wd, "TO") != 0' please?

---------------------------------------------------------------------------

Greg Sabino Mullane wrote:
[ There is text before PGP section. ]
>
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
>
> Quick patch to adress a recent concern on the mailing list
> about adding an errant "TO" when we already have a TO. Since
> TO cannot be a valid column name (we must quote it), we can
> simply ignore the tab-completion if the previous word
> was a "TO"
>
> - --
> Greg Sabino Mullane greg@turnstep.com
> PGP Key: 0x14964AC8 200504112303
> http://biglumber.com/x/web?pk=2529DF6AB8F79407E94445B4BC9B906714964AC8
>
> Index: tab-complete.c
> ===================================================================
> RCS file: /projects/cvsroot/pgsql/src/bin/psql/tab-complete.c,v
> retrieving revision 1.124
> diff -c -r1.124 tab-complete.c
> *** tab-complete.c      7 Apr 2005 01:51:39 -0000       1.124
> - --- tab-complete.c    11 Apr 2005 16:17:07 -0000
> ***************
> *** 820,826 ****
>
>         /* ALTER TABLE xxx RENAME yyy */
>         else if (pg_strcasecmp(prev4_wd, "TABLE") == 0 &&
> !                        pg_strcasecmp(prev2_wd, "RENAME") == 0)
>                 COMPLETE_WITH_CONST("TO");
>
>         /* If we have TABLE <sth> DROP, provide COLUMN or CONSTRAINT */
> - --- 820,827 ----
>
>         /* ALTER TABLE xxx RENAME yyy */
>         else if (pg_strcasecmp(prev4_wd, "TABLE") == 0 &&
> !                        pg_strcasecmp(prev2_wd, "RENAME") == 0 &&
> !                                        pg_strcasecmp(prev_wd, "TO"))
>                 COMPLETE_WITH_CONST("TO");
>
>         /* If we have TABLE <sth> DROP, provide COLUMN or CONSTRAINT */
>
> -----BEGIN PGP SIGNATURE-----
>
> iD8DBQFCWzrJvJuQZxSWSsgRAlWgAJ9HkwLfDTkLngWvQQH0qXspAHZSgACgrZvj
> sjqcPohL54+0eDSlUQDQADc=
> =iyxJ
> -----END PGP SIGNATURE-----
>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 6: Have you searched our list archives?
>
>                http://archives.postgresql.org
>

--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073