| From: | Craig Ringer <craig(at)2ndquadrant(dot)com> | 
|---|---|
| To: | PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org> | 
| Subject: | [PATCH] print help from psql when user tries to run pg_restore, pg_dump etc | 
| Date: | 2019-12-06 04:58:11 | 
| Message-ID: | CAMsr+YHzPP7AcZ3vbmArvK86bWp_4tE6uGEh=owR5Zoa7s_+iw@mail.gmail.com | 
| Views: | Whole Thread | Raw Message | Download mbox | Resend email | 
| Thread: | |
| Lists: | pgsql-hackers | 
New users frequently attempt to run PostgreSQL's command line utilities
from the psql prompt.
They tend to be confused when this appears to do absolutely nothing:
        psql=> pg_restore
        psql->
since they're generally not going to semicolon-terminate the command either.
The attached patch detects common command names when they appear first on a
new input line prints a help message. If the buffer is empty a more
detailed message is printed and the input is swallowed. Otherwise, much
like how we handle "help" etc,
a short message is printed and the input is still added to the buffer.
    psql=> pg_restore
    "pg_restore" is a command line utility program.
    Use it from the system terminal or command prompt not from psql.
    psql=>
    psql=> select 1
    psql-> pg_restore
    "pg_restore" is a command-line utility program not a psql command. See
"help".
    psql->
Wording advice would be welcome.
I'd be tempted to backpatch this, since it's one of the things I see users
confused by most often now - right up there with pg_hba.conf issues,
forgetting a semicolon in psql, etc.
-- 
 Craig Ringer                   http://www.2ndQuadrant.com/
 2ndQuadrant - PostgreSQL Solutions for the Enterprise
| Attachment | Content-Type | Size | 
|---|---|---|
| 0001-print-help-in-psql-when-users-try-to-run-pg_dump-etc.patch | text/x-patch | 2.8 KB | 
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Michael Paquier | 2019-12-06 05:09:05 | Re: Increase footprint of %m and reduce strerror() | 
| Previous Message | Tom Lane | 2019-12-06 04:40:37 | Re: Update minimum SSL version |