Proposal: %T Prompt parameter for psql for current time (like Oracle has) - Mailing list pgsql-hackers

From Kirk Wolak
Subject Proposal: %T Prompt parameter for psql for current time (like Oracle has)
Date
Msg-id CACLU5mSRwHr_8z=enMj-nXF1tmC7+Jn5heZQNiKuLyxYUtL2fg@mail.gmail.com
Whole thread Raw
Responses Re: Proposal: %T Prompt parameter for psql for current time (like Oracle has)
Re: Proposal: %T Prompt parameter for psql for current time (like Oracle has)
List pgsql-hackers
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 recommending no formatting options, just keep it simple.  No, I don't care about adding the date.  If I don't know the date of some line in my history, it's already a problem!  (And date would logically be some other variable)

Yes, I've found ways around it using the shell backquote.  This is hacky, and it's also really ugly in windows. I also found it impossible to share my plpgsqlrc file because between linux and windows.

This would be current time on the local machine.  Keeping it simple.

It feels like a small change.  The simplest test would be to capture the prompt, select sleep(1.1); and make sure the prompt change.  This code should be trivially stable.

If it seems useful, I believe I can work with others to get it implemented, and the documentation changed, and a patch generated.  (I need to develop these skills)

What does the community say?  Is there support for this?

Regards, Kirk


pgsql-hackers by date:

Previous
From: Nathan Bossart
Date:
Subject: Re: DDL result is lost by CREATE DATABASE with WAL_LOG strategy
Next
From: Jeff Davis
Date:
Subject: Re: Non-superuser subscription owners