Re: psql: show only failed queries - Mailing list pgsql-hackers

From Pavel Stehule
Subject Re: psql: show only failed queries
Date
Msg-id CAFj8pRAYtymcoe4nbLOg4sMb0gsa3pXafVHbm8WKgPJDFYd+Ng@mail.gmail.com
Whole thread Raw
In response to Re: psql: show only failed queries  (Fujii Masao <masao.fujii@gmail.com>)
Responses Re: psql: show only failed queries
List pgsql-hackers
Hello

updated version patch in attachment

2014-08-05 13:31 GMT+02:00 Fujii Masao <masao.fujii@gmail.com>:
On Wed, Jul 16, 2014 at 4:34 AM, Pavel Stehule <pavel.stehule@gmail.com> wrote:
>
>
>
> 2014-07-15 12:07 GMT+02:00 Fujii Masao <masao.fujii@gmail.com>:
>
>> On Tue, Jul 15, 2014 at 7:01 PM, Pavel Stehule <pavel.stehule@gmail.com>
>> wrote:
>> >
>> >
>> >
>> > 2014-07-15 11:29 GMT+02:00 Fujii Masao <masao.fujii@gmail.com>:
>> >
>> >> On Thu, Jul 10, 2014 at 9:56 PM, Pavel Stehule
>> >> <pavel.stehule@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

pgsql-hackers by date:

Previous
From: David G Johnston
Date:
Subject: Re: select_common_type()'s behavior doesn't match the documentation
Next
From: Marko Tiikkaja
Date:
Subject: Re: plpgsql.extra_warnings='num_into_expressions'