Hello updated version patch in attachment
2014-08-05 13:31 GMT+02:00 Fujii Masao <masao.fu...@gmail.com>: > On Wed, Jul 16, 2014 at 4:34 AM, Pavel Stehule <pavel.steh...@gmail.com> > wrote: > > > > > > > > 2014-07-15 12:07 GMT+02:00 Fujii Masao <masao.fu...@gmail.com>: > > > >> On Tue, Jul 15, 2014 at 7:01 PM, Pavel Stehule <pavel.steh...@gmail.com > > > >> wrote: > >> > > >> > > >> > > >> > 2014-07-15 11:29 GMT+02:00 Fujii Masao <masao.fu...@gmail.com>: > >> > > >> >> On Thu, Jul 10, 2014 at 9:56 PM, Pavel Stehule > >> >> <pavel.steh...@gmail.com> > >> >> wrote: > >> >> > Hello > >> >> > > >> >> > here is a proposed patch - autocomplete for known psql variable > >> >> > content > >> >> > >> >> Even after applying the patch, the following psql variables were not > >> >> displayed > >> >> on the tab-completion of \set command. > >> >> > >> >> HISTFILE > >> >> HISTSIZE > >> >> HOST > >> >> IGNOREEOF > >> >> LASTOID > >> >> > >> >> I'm not sure if it's worth displaying all of them on the > tab-completion > >> >> of > >> >> \set > >> >> because it seems strange to change some of them by \set command, for > >> >> example > >> >> HOST, though. > >> > > >> > > >> > For these variables are not default - so doesn't exist and cannot be > >> > completed by default. > >> > > >> > there are two fix: > >> > > >> > a) fix autocomplete source - preferred > >> > >> +1 > > > > > > here is the patch > > Thanks for the patch! > > I got the following compiler warnings. > > tab-complete.c:4155: warning: assignment discards qualifiers from > pointer target type > tab-complete.c:4166: warning: assignment discards qualifiers from > pointer target type > fixed > > + "FETCH_COUNT", "HISTCONTROL", "HISTFILE", "HISTSIZE", "HOST", > "IGNOREOFF", > > Typo: IGNOREOFF -> IGNOREEOF > fixed > > + /* all psql known variables are included in list by default */ > + for (known_varname = known_varnames; *known_varname; known_varname++) > + varnames[nvars++] = pg_strdup(*known_varname); > > Don't we need to append both prefix and suffix to even known variables? > ??? I am not sure if I understand well - probably system "read only" variables as DBNAME, USER, VERSION should not be there > > + else if (strcmp(prev2_wd, "\\set") == 0) > + { > + if (strcmp(prev_wd, "AUTOCOMMIT") == 0) > > ISTM that some psql variables like IGNOREEOF are not there. Why not? > yes, there are not complete for DBNAME, ENCODING, FETCH_COUNT, HISTCONTROL, HISTFILE, HISTSIZE, HOST, IGNOREEOFF, PROMPT*,USER, VERSION There are more reasons: * paremeter is not a enum (string, number or both): FETCH_COUNT, PROMPT, HISTSIZE, .. * variable is pseudo read only - change has not any effect: DBNAME, ENCODING, VERSION Regards Pavel > > Regards, > > -- > Fujii Masao >