[HACKERS] Newbie project: Detect attempts to run pg_dump etc on psql, \copy on server - Mailing list pgsql-hackers

From Craig Ringer
Subject [HACKERS] Newbie project: Detect attempts to run pg_dump etc on psql, \copy on server
Date
Msg-id CAMsr+YGH4iAZebbuubEtiqEMgv9c0ynvL_Thgh3PHR2tr4fWFA@mail.gmail.com
Whole thread Raw
List pgsql-hackers
This is a proposal for a new developer patch idea, in case someone's interested.

Keeping an eye on Stack Overflow has shown me that quite a few people
seem to get confused by pg_dump and pg_restore being command line
tools, not psql commands.

It'd be interesting if psql detected this and gave a useful error.
Ideally before they enter ; to terminate the line, since they're
probably following instructions that won't show one.

A related patch would be to have the parser detect \copy and other
psql backslash metacommands run as SQL queries on the server and
report a useful error. For \copy, it would HINT to look at their
client's manual for COPY support or user server-side COPY. For others
it'd say these are psql commands not postgres commands and only work
in the psql client.

One might argue that we don't need to pad things _this_ much for new
users. But I see users getting confused by psql metacommands vs
postgres server commands a lot. Similarly by pg_dump and pg_restore
being shell programs.

If it can be done at minimal cost to everyone else, it might be worth
it. Just an idea.

-- Craig Ringer                   http://www.2ndQuadrant.com/PostgreSQL Development, 24x7 Support, Training & Services



pgsql-hackers by date:

Previous
From: Andres Freund
Date:
Subject: Re: [HACKERS] snapbuild woes
Next
From: Petr Jelinek
Date:
Subject: Re: [HACKERS] snapbuild woes