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

From: Kirk Wolak <wolakk(at)gmail(dot)com>
To: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Cc: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>, amborodin86(at)gmail(dot)com, Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>, samokhvalov(at)gmail(dot)com
Subject: Proposal: %T Prompt parameter for psql for current time (like Oracle has)
Date: 2023-02-22 17:17:46
Message-ID: CACLU5mSRwHr_8z=enMj-nXF1tmC7+Jn5heZQNiKuLyxYUtL2fg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Jeff Davis 2023-02-22 17:18:34 Re: Non-superuser subscription owners
Previous Message Nathan Bossart 2023-02-22 17:08:28 Re: DDL result is lost by CREATE DATABASE with WAL_LOG strategy