Re: PSQL commands not backwards-compatible - Mailing list pgsql-bugs

From Tom Lane
Subject Re: PSQL commands not backwards-compatible
Date
Msg-id 3278.1125511513@sss.pgh.pa.us
Whole thread Raw
In response to Re: PSQL commands not backwards-compatible  (Josh Berkus <josh@agliodbs.com>)
Responses Re: PSQL commands not backwards-compatible
List pgsql-bugs
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

pgsql-bugs by date:

Previous
From: Josh Berkus
Date:
Subject: Re: PSQL commands not backwards-compatible
Next
From: "Jim C. Nasby"
Date:
Subject: Re: PSQL commands not backwards-compatible