Josh Berkus <josh@agliodbs.com> writes:
> Hmmm ... how difficult would it be to give a useful error message instead of a
> SQL error? Something like:
> "I'm sorry, that PSQL command did not work. Most likely, you are connecting
> to a different version of PostgreSQL."
Well, "useful" is in the eye of the beholder ... in particular, if you are
trying to debug a problem with the \d commands, you would want to see
the actual backend message. OTOH you would probably also want to see
the query actually issued. So maybe we could make this conditional on
the -E mode?
if -E: print the actual backend error message, as now
else: print "Query failed, probably because backend is a different Postgres release"
Also, we can *know* rather than guess whether the backend is a different
major version, so maybe do the "user-friendly" printout only if (a) not -E
mode and (b) there is a version discrepancy. If there's not a version
discrepancy then the failure is unexpected and we shouldn't be hiding
information about it.
I like this better than Bruce's recent proposal to print a warning at
psql startup, because it emits the info when you actually need it.
How many people pay attention to psql's startup banner at all?
regards, tom lane