Display output file name in psql prompt?

From: Alex <ash(at)commandprompt(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Display output file name in psql prompt?
Date: 2013-03-12 20:05:10
Message-ID: 87zjy8bczt.fsf@commandprompt.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


Hello fellow hackers,

Today when I get back home and connected to my psql prompt I've left
running under $terminal_multiplexor I've run some SQL, but no output did
appear on my screen. I have immediately realized that it must be
sending it to a file instead of STDOUT as I have instructed it earlier
today using \o command, but have totally forgot about the fact.

So I wonder if there's a way to make psql display the current output
file/command in the prompt? After reading the current docs, I don't see
any option. Would a patch be accepted for submission (make it into
default prompt, unless stdout?)

Something like this:

\set PROMPT1 '%/:%o%R%# '
postgres:/path/to/output/file.txt=>

--
Regards,
Alex

PS: upon reading the docs more carefully, I guess I should have used \g
instead of \o, but still this might be not a bad feature to have.

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2013-03-12 21:41:59 Re: Display output file name in psql prompt?
Previous Message Josh Berkus 2013-03-12 20:02:10 Re: Incorrect handling of timezones with extract