Re: Proposal: %T Prompt parameter for psql for current time (like Oracle has)

2023-07-03 Thread Daniel Gustafsson
> On 1 Mar 2023, at 10:29, Jim Jones wrote: > > On 01.03.23 01:47, Kirk Wolak wrote: >> Patch Posted with one edit, for line editings (Thanks Jim!) > The patch didn't pass the SanityCheck: > > https://cirrus-ci.com/task/5445242183221248?logs=build#L1337 > > missing a header perhaps? > >

Re: Proposal: %T Prompt parameter for psql for current time (like Oracle has)

2023-04-08 Thread Pavel Stehule
ne 9. 4. 2023 v 3:54 odesílatel Tom Lane napsal: > Greg Stark writes: > > I'm not sure if the *prompt* is a sensible place for it though. The > > place it seems like it would be most useful is reading the output of > > script executions where there would be no prompts. Perhaps it's the > >

Re: Proposal: %T Prompt parameter for psql for current time (like Oracle has)

2023-04-08 Thread Tom Lane
Greg Stark writes: > I'm not sure if the *prompt* is a sensible place for it though. The > place it seems like it would be most useful is reading the output of > script executions where there would be no prompts. Perhaps it's the > command tags and \echo statements that should be timestamped.

Re: Proposal: %T Prompt parameter for psql for current time (like Oracle has)

2023-04-08 Thread Greg Stark
On Wed, 22 Feb 2023 at 13:38, Kirk Wolak wrote: > > I already requested ONLY the HH24 format. 8 characters of output. no > options. It's a waste of time. > After all these years, sqlplus still has only one setting (show it, or not). > I am asking the same here. > And I will gladly defend

Re: Proposal: %T Prompt parameter for psql for current time (like Oracle has)

2023-03-02 Thread Kirk Wolak
On Thu, Mar 2, 2023 at 9:56 AM Laurenz Albe wrote: > On Wed, 2023-03-01 at 11:13 -0500, Kirk Wolak wrote: > > Thanks, corrected, and confirmed Unix line endings. > > The patch builds fine and works as intended. > > I leave it to the committers to decide whether the patch is worth the > effort or

Re: Proposal: %T Prompt parameter for psql for current time (like Oracle has)

2023-03-02 Thread Laurenz Albe
On Wed, 2023-03-01 at 11:13 -0500, Kirk Wolak wrote: > Thanks, corrected, and confirmed Unix line endings. The patch builds fine and works as intended. I leave it to the committers to decide whether the patch is worth the effort or not, given that you can get a similar effect with %`date`. It

Re: Proposal: %T Prompt parameter for psql for current time (like Oracle has)

2023-03-01 Thread Kirk Wolak
On Wed, Mar 1, 2023 at 11:55 AM Jim Jones wrote: > On 01.03.23 17:13, Kirk Wolak wrote: > > Thanks, corrected, and confirmed Unix line endings. > FWIW, the simplest way to test it is with this command (I usually get it > wrong on the first guess) > > \set PROMPT1 %T ' ' :PROMPT1 > > Kirk > >

Re: Proposal: %T Prompt parameter for psql for current time (like Oracle has)

2023-03-01 Thread Jim Jones
On 01.03.23 17:13, Kirk Wolak wrote: Thanks, corrected, and confirmed Unix line endings. FWIW, the simplest way to test it is with this command (I usually get it wrong on the first guess) \set PROMPT1 %T ' ' :PROMPT1 Kirk Nice. The patch applies clean and the cfbots seem much happier now -

Re: Proposal: %T Prompt parameter for psql for current time (like Oracle has)

2023-03-01 Thread Kirk Wolak
On Wed, Mar 1, 2023 at 4:41 AM Jim Jones wrote: > On 01.03.23 01:59, Kirk Wolak wrote: > > I cannot get the last email to show up for the commitfest. > > This is version 2 of the original patch. [1] > > Thanks Jim! > > > > [1] >

Re: Proposal: %T Prompt parameter for psql for current time (like Oracle has)

2023-03-01 Thread Jim Jones
On 01.03.23 01:59, Kirk Wolak wrote: I cannot get the last email to show up for the commitfest. This is version 2 of the original patch. [1] Thanks Jim! [1]https://postgr.es/m/CACLU5mSRwHr_8z%3DenMj-nXF1tmC7%2BJn5heZQNiKuLyxYUtL2fg%40mail.gmail.com Regards Kirk. The patch didn't pass the

Re: Proposal: %T Prompt parameter for psql for current time (like Oracle has)

2023-03-01 Thread Jim Jones
On 01.03.23 01:47, Kirk Wolak wrote: Patch Posted with one edit, for line editings (Thanks Jim!) The patch didn't pass the SanityCheck: https://cirrus-ci.com/task/5445242183221248?logs=build#L1337 missing a header perhaps? #include "time.h" Best, Jim

Proposal: %T Prompt parameter for psql for current time (like Oracle has)

2023-02-28 Thread Kirk Wolak
I cannot get the last email to show up for the commitfest. This is version 2 of the original patch. [1] Thanks Jim! [1] https://postgr.es/m/CACLU5mSRwHr_8z%3DenMj-nXF1tmC7%2BJn5heZQNiKuLyxYUtL2fg%40mail.gmail.com Regards Kirk. From b9db157177bbdeeeb6d35c3623ca9355141419d7 Mon Sep 17 00:00:00

Re: Proposal: %T Prompt parameter for psql for current time (like Oracle has)

2023-02-28 Thread Kirk Wolak
On Thu, Feb 23, 2023 at 2:05 PM Kirk Wolak wrote: > On Thu, Feb 23, 2023 at 9:52 AM Tom Lane wrote: > >> Heikki Linnakangas writes: >> > On 23/02/2023 13:20, Peter Eisentraut wrote: >> >> If you don't have \timing turned on before the query starts, psql won't >> >> record what the time was

Re: Proposal: %T Prompt parameter for psql for current time (like Oracle has)

2023-02-23 Thread Kirk Wolak
On Thu, Feb 23, 2023 at 9:52 AM Tom Lane wrote: > Heikki Linnakangas writes: > > On 23/02/2023 13:20, Peter Eisentraut wrote: > >> If you don't have \timing turned on before the query starts, psql won't > >> record what the time was before the query, so you can't compute the run > >> time

Re: Proposal: %T Prompt parameter for psql for current time (like Oracle has)

2023-02-23 Thread Kirk Wolak
On Thu, Feb 23, 2023 at 1:16 PM Maciek Sakrejda wrote: > On Thu, Feb 23, 2023, 09:55 Nikolay Samokhvalov > wrote: > >> On Thu, Feb 23, 2023 at 9:05 AM Maciek Sakrejda >> wrote: >> >>> I think Heikki's solution is probably more practical since (1) .. >> >> >> Note that these ideas target two

Re: Proposal: %T Prompt parameter for psql for current time (like Oracle has)

2023-02-23 Thread Pavel Stehule
čt 23. 2. 2023 v 19:16 odesílatel Maciek Sakrejda napsal: > On Thu, Feb 23, 2023, 09:55 Nikolay Samokhvalov > wrote: > >> On Thu, Feb 23, 2023 at 9:05 AM Maciek Sakrejda >> wrote: >> >>> I think Heikki's solution is probably more practical since (1) .. >> >> >> Note that these ideas target two

Re: Proposal: %T Prompt parameter for psql for current time (like Oracle has)

2023-02-23 Thread Maciek Sakrejda
On Thu, Feb 23, 2023, 09:55 Nikolay Samokhvalov wrote: > On Thu, Feb 23, 2023 at 9:05 AM Maciek Sakrejda > wrote: > >> I think Heikki's solution is probably more practical since (1) .. > > > Note that these ideas target two *different* problems: > - what was the duration of the last query > -

Re: Proposal: %T Prompt parameter for psql for current time (like Oracle has)

2023-02-23 Thread Nikolay Samokhvalov
On Thu, Feb 23, 2023 at 9:05 AM Maciek Sakrejda wrote: > I think Heikki's solution is probably more practical since (1) .. Note that these ideas target two *different* problems: - what was the duration of the last query - when was the last query executed So, having both solved would be ideal.

Re: Proposal: %T Prompt parameter for psql for current time (like Oracle has)

2023-02-23 Thread Maciek Sakrejda
+1 on solving the general problem of "I forgot to set \timing--how long did this run?". I could have used that more than once in the past, and I'm sure it will come up again. I think Heikki's solution is probably more practical since (1) even if we add the prompt parameter originally proposed, I

Re: Proposal: %T Prompt parameter for psql for current time (like Oracle has)

2023-02-23 Thread Tom Lane
Heikki Linnakangas writes: > On 23/02/2023 13:20, Peter Eisentraut wrote: >> If you don't have \timing turned on before the query starts, psql won't >> record what the time was before the query, so you can't compute the run >> time afterwards. This kind of feature would only work if you always

Re: Proposal: %T Prompt parameter for psql for current time (like Oracle has)

2023-02-23 Thread Heikki Linnakangas
On 23/02/2023 13:20, Peter Eisentraut wrote: On 22.02.23 19:14, Heikki Linnakangas wrote: How about a new backslash command or psql variable to show how long the previous statement took? Something like: If you don't have \timing turned on before the query starts, psql won't record what the

Re: Proposal: %T Prompt parameter for psql for current time (like Oracle has)

2023-02-23 Thread Peter Eisentraut
On 22.02.23 19:14, Heikki Linnakangas wrote: How about a new backslash command or psql variable to show how long the previous statement took? Something like: If you don't have \timing turned on before the query starts, psql won't record what the time was before the query, so you can't compute

Re: Proposal: %T Prompt parameter for psql for current time (like Oracle has)

2023-02-22 Thread Nathan Bossart
On Wed, Feb 22, 2023 at 07:17:37PM +0100, Daniel Gustafsson wrote: >> On 22 Feb 2023, at 19:14, Heikki Linnakangas wrote: > >> How about a new backslash command or psql variable to show how long the >> previous statement took? Something like: >> >> postgres=# select >> ?column? >> --

Re: Proposal: %T Prompt parameter for psql for current time (like Oracle has)

2023-02-22 Thread Pavel Stehule
st 22. 2. 2023 v 18:59 odesílatel Nikolay Samokhvalov napsal: > On Wed, Feb 22, 2023 at 9:55 AM Tom Lane wrote: > >> On the whole I'd rather not eat more of the limited namespace for >> psql prompt codes for this. >> > > It depends on personal preferences. When I work on a large screen, I can >

Re: Proposal: %T Prompt parameter for psql for current time (like Oracle has)

2023-02-22 Thread Kirk Wolak
On Wed, Feb 22, 2023 at 1:14 PM Heikki Linnakangas wrote: > On 22/02/2023 19:59, Nikolay Samokhvalov wrote: > > On Wed, Feb 22, 2023 at 9:55 AM Tom Lane > > wrote: > > > > On the whole I'd rather not eat more of the limited namespace for > > psql prompt codes

Re: Proposal: %T Prompt parameter for psql for current time (like Oracle has)

2023-02-22 Thread Kirk Wolak
On Wed, Feb 22, 2023 at 12:55 PM Tom Lane wrote: > Kirk Wolak writes: > > Proposal: Simply add the %T (PROMPT variable) to output the current time > > (HH24:MI:SS) into the prompt. > > I'm not really convinced that %`date` isn't a usable solution for this, > especially since it seems like a

Re: Proposal: %T Prompt parameter for psql for current time (like Oracle has)

2023-02-22 Thread Pavel Stehule
st 22. 2. 2023 v 19:14 odesílatel Heikki Linnakangas napsal: > On 22/02/2023 19:59, Nikolay Samokhvalov wrote: > > On Wed, Feb 22, 2023 at 9:55 AM Tom Lane > > wrote: > > > > On the whole I'd rather not eat more of the limited namespace for > > psql prompt

Re: Proposal: %T Prompt parameter for psql for current time (like Oracle has)

2023-02-22 Thread Pavel Stehule
Hi st 22. 2. 2023 v 18:55 odesílatel Tom Lane napsal: > Kirk Wolak writes: > > Proposal: Simply add the %T (PROMPT variable) to output the current time > > (HH24:MI:SS) into the prompt. > > I'm not really convinced that %`date` isn't a usable solution for this, > especially since it seems

Re: Proposal: %T Prompt parameter for psql for current time (like Oracle has)

2023-02-22 Thread Daniel Gustafsson
> On 22 Feb 2023, at 19:14, Heikki Linnakangas wrote: > How about a new backslash command or psql variable to show how long the > previous statement took? Something like: > > postgres=# select > ?column? > -- > 123 > (1 row) > > postgres=# \time > > Time: 14011.975 ms

Re: Proposal: %T Prompt parameter for psql for current time (like Oracle has)

2023-02-22 Thread Heikki Linnakangas
On 22/02/2023 19:59, Nikolay Samokhvalov wrote: On Wed, Feb 22, 2023 at 9:55 AM Tom Lane > wrote: On the whole I'd rather not eat more of the limited namespace for psql prompt codes for this. It depends on personal preferences. When I work on a large screen,

Re: Proposal: %T Prompt parameter for psql for current time (like Oracle has)

2023-02-22 Thread Nikolay Samokhvalov
On Wed, Feb 22, 2023 at 9:55 AM Tom Lane wrote: > On the whole I'd rather not eat more of the limited namespace for > psql prompt codes for this. > It depends on personal preferences. When I work on a large screen, I can afford to spend some characters in prompts, if it gives convenience – and

Re: Proposal: %T Prompt parameter for psql for current time (like Oracle has)

2023-02-22 Thread Tom Lane
Kirk Wolak writes: > Proposal: Simply add the %T (PROMPT variable) to output the current time > (HH24:MI:SS) into the prompt. I'm not really convinced that %`date` isn't a usable solution for this, especially since it seems like a very niche requirement. The next person who wants it might well

Re: Proposal: %T Prompt parameter for psql for current time (like Oracle has)

2023-02-22 Thread Nikolay Samokhvalov
On Wed, Feb 22, 2023 at 9:18 AM Kirk Wolak wrote: > Proposal: Simply add the %T (PROMPT variable) to output the current time > (HH24:MI:SS) into the prompt. This has been in sqlplus since I can > remember, and I find it really useful when I forgot to time something, or > to review for Time

Proposal: %T Prompt parameter for psql for current time (like Oracle has)

2023-02-22 Thread Kirk Wolak
Proposal: Simply add the %T (PROMPT variable) to output the current time (HH24:MI:SS) into the prompt. This has been in sqlplus since I can remember, and I find it really useful when I forgot to time something, or to review for Time spent on a problem, or for how old my session is... I am