Unix Technical Forum

Not to to confusing

This is a discussion on Not to to confusing within the Pgsql Patches forums, part of the PostgreSQL category; --> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Quick patch to adress a recent concern on the mailing list about adding ...


Go Back   Unix Technical Forum > Database Server Software > PostgreSQL > Pgsql Patches

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-18-2008, 12:14 AM
Greg Sabino Mullane
 
Posts: n/a
Default Not to to confusing


-----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=2529DF...9B906714964AC8

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-----

iD8DBQFCWzrJvJuQZxSWSsgRAlWgAJ9HkwLfDTkLngWvQQH0qX spAHZSgACgrZvj
sjqcPohL54+0eDSlUQDQADc=
=iyxJ
-----END PGP SIGNATURE-----



---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://archives.postgresql.org

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 04-18-2008, 12:14 AM
Tom Lane
 
Posts: n/a
Default Re: Not to to confusing

"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

---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://archives.postgresql.org

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 04-18-2008, 12:22 AM
Bruce Momjian
 
Posts: n/a
Default Re: Not to to confusing


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=2529DF...9B906714964AC8
>
> 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-----
>
> iD8DBQFCWzrJvJuQZxSWSsgRAlWgAJ9HkwLfDTkLngWvQQH0qX spAHZSgACgrZvj
> 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

---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddressHere" to majordomo@postgresql.org)

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 04:42 PM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com