[Sorry for not CC'ing the list before, I'm still getting used to the new Gmail interface]
On Tue, Nov 8, 2011 at 11:05 PM, Josh Kupershmidt <schmi...@gmail.com> wrote: > On Tue, Nov 8, 2011 at 10:04 PM, Tom Lane <t...@sss.pgh.pa.us> wrote: >> Josh Kupershmidt <schmi...@gmail.com> writes: >>> We're essentially pretending that we support all server versions with >>> this code, instead of erroring out on some definite old version and >>> admitting "sorry, can't do it". ... >>> I think we should draw a line somewhere about just how far back psql >>> must support, >> >> Says right at the top of the file: >> >> * Support for the various \d ("describe") commands. Note that the current >> * expectation is that all functions in this file will succeed when working >> * with servers of versions 7.4 and up. It's okay to omit irrelevant >> * information for an old server, but not to fail outright. > > Oh, heh, I did miss that note. 7.4 is a reasonable target, I guess. > It's not clear to me from that comment whether it's acceptable for the > code to "fail outright" on servers older than 7.4, as in the snippet I > posted, but I'm pretty sure that is what would happen. (I don't have a > 7.x install handy to test that theory, as I haven't been able to build > anything older than 8.0.) FWIW, I just played around with 7.4 and 7.3 servers. (I had some bad memories of the older tarballs not building, but that must have been only on OS X -- I can build at least back to 7.3 on this Ubuntu 11.04 machine.) Most meta-commands worked alright on 7.4, or at least failed gracefully. The ones I saw which failed unexpectedly were \sf and \ef, which complained: ERROR: function pg_catalog.pg_get_functiondef(integer) does not exist I think we need a server version check for these two meta-commands, unless someone cares to make them work on < 8.4, trivial patch attached. As I suggested, many more unexpected failures (e.g. \dnS+) pop up when talking to a 7.3 server. It's not a big deal, but it'd be nice if we could instead error out with a "sorry, we're too lazy to try to support 7.3" on the meta-commands which fail thusly, and make the various "else" clauses more explicit about just how far back their support really goes. Josh
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c index 2c38902..121612c 100644 *** a/src/bin/psql/command.c --- b/src/bin/psql/command.c *************** exec_command(const char *cmd, *** 583,589 **** { int lineno = -1; ! if (!query_buf) { psql_error("no query buffer\n"); status = PSQL_CMD_ERROR; --- 583,595 ---- { int lineno = -1; ! if (pset.sversion < 80400) ! { ! psql_error("The server (version %d.%d) does not support editing function source.\n", ! pset.sversion / 10000, (pset.sversion / 100) % 100); ! status = PSQL_CMD_ERROR; ! } ! else if (!query_buf) { psql_error("no query buffer\n"); status = PSQL_CMD_ERROR; *************** exec_command(const char *cmd, *** 1115,1121 **** func_buf = createPQExpBuffer(); func = psql_scan_slash_option(scan_state, OT_WHOLE_LINE, NULL, true); ! if (!func) { psql_error("function name is required\n"); status = PSQL_CMD_ERROR; --- 1121,1133 ---- func_buf = createPQExpBuffer(); func = psql_scan_slash_option(scan_state, OT_WHOLE_LINE, NULL, true); ! if (pset.sversion < 80400) ! { ! psql_error("The server (version %d.%d) does not support showing function source.\n", ! pset.sversion / 10000, (pset.sversion / 100) % 100); ! status = PSQL_CMD_ERROR; ! } ! else if (!func) { psql_error("function name is required\n"); status = PSQL_CMD_ERROR;
-- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers