Re: psql: show only failed queries

From: Fujii Masao <masao(dot)fujii(at)gmail(dot)com>
To: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
Cc: Abhijit Menon-Sen <ams(at)2ndquadrant(dot)com>, Rajeev rastogi <rajeev(dot)rastogi(at)huawei(dot)com>, Samrat Revagade <revagade(dot)samrat(at)gmail(dot)com>, Peter Eisentraut <peter_e(at)gmx(dot)net>, Fabrízio Mello <fabriziomello(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: psql: show only failed queries
Date: 2014-08-12 03:16:36
Message-ID: CAHGQGwG1dWWtTGuwt6BnZg=T+kMmnOSAppfSdTV1qZNqowU8cQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Aug 12, 2014 at 4:41 AM, Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com> wrote:
>
>
>
> 2014-08-11 14:59 GMT+02:00 Fujii Masao <masao(dot)fujii(at)gmail(dot)com>:
>
>> On Sat, Aug 9, 2014 at 4:16 AM, Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
>> wrote:
>> > Hi
>> >
>> >
>> > 2014-08-08 13:58 GMT+02:00 Fujii Masao <masao(dot)fujii(at)gmail(dot)com>:
>> >
>> >> On Fri, Aug 8, 2014 at 4:31 AM, Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
>> >> wrote:
>> >> >
>> >> >
>> >> >
>> >> > 2014-08-07 7:10 GMT+02:00 Fujii Masao <masao(dot)fujii(at)gmail(dot)com>:
>> >> >
>> >> >> On Thu, Aug 7, 2014 at 6:26 AM, Pavel Stehule
>> >> >> <pavel(dot)stehule(at)gmail(dot)com>
>> >> >> wrote:
>> >> >> > Hello
>> >> >> >
>> >> >> > updated version patch in attachment
>> >> >>
>> >> >> Thanks! But ISTM you forgot to attached the patch.
>> >> >
>> >> >
>> >> > grr .. I am sorry
>> >>
>> >> No problem. Thanks for the patch! Attached is the revised version of
>> >> the
>> >> patch.
>> >>
>> >> >> >> + /* 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
>> >> >>
>> >> >> I had that question because complete_from_variables() is also called
>> >> >> by
>> >> >> the
>> >> >> tab-completion of "\echo :" and it shows half-baked variables list.
>> >> >> So
>> >> >> I thought probably we need to change complete_from_variables() more
>> >> >> to
>> >> >> fix the problem.
>> >> >
>> >> >
>> >> > I understand now.
>> >> >
>> >> > I fixed it.
>> >> >
>> >> > I have a question.\echo probably should not to show empty known
>> >> > variable.
>> >> >
>> >> > data for autocomplete for \echo should be same as result of "\set"
>> >>
>> >> Agreed. I think that only the variables having the set values should be
>> >> displayed in "\echo :" case. So I modified complete_from_variables()
>> >> so that the unset variables are not shown in that case but all the
>> >> variables
>> >> are shown in the tab-completion of "\set".
>> >>
>> >> >> >> + 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
>> >> >>
>> >> >> So HISTCONTROL should be there because it doesn't have such reasons
>> >> >> at
>> >> >> all?
>> >> >>
>> >> >
>> >> > yes
>> >>
>> >> ISTM that you forgot to add HISTCONTROL to your patch. So I just added
>> >> that.
>> >>
>> >> I added the tab-completion for "\unset" command. Like "\echo :", only
>> >> the variables having the set values should be displayed in "\unset"
>> >> case.
>> >
>> >
>> > perfect
>> >
>> >>
>> >>
>> >> I changed complete_from_variables() so that it checks the memory size
>> >> of
>> >> the variable array even when appending the known variables. If the
>> >> memory
>> >> size is not enough, it's dynamically increased. Practically this check
>> >> would
>> >> not be required because the initial size of the array is enough larger
>> >> than
>> >> the number of the known variables. I added this as the safe-guard.
>> >>
>> >> Typo: IGNOREEOFF -> IGNOREEOF
>> >>
>> >> I removed the value "none" from the value list of "ECHO" because it's
>> >> not
>> >> documented and a user might get confused when he or she sees the
>> >> undocumented
>> >> value "none". Thought?
>> >
>> >
>> > isn't better to fix doc? I don't know any reason why we should not to
>> > support "none"
>>
>> I'm OK with this. The attached patch adds the support of "none" value both
>> in ECHO and HISTCONTROL variables (because HISTCONTROL had the same
>> problem as ECHO had), and also adds the description of that value into
>> the document.
>>
>> > I looked to code, you removed a check against duplicate varname in list.
>> > Is
>> > it ok?
>>
>> Oh, just revived that code.
>
>
> yes, It is looking well

Ok, committed!

Regards,

--
Fujii Masao

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Pavel Stehule 2014-08-12 03:18:11 Re: psql: show only failed queries
Previous Message Michael Paquier 2014-08-12 01:06:05 Re: Improvement of versioning on Windows, take two