diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2011-11-10 18:37:05 -0500 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2011-11-10 18:37:05 -0500 |
commit | 2463f5da3ccd67b266ee7a9b8c0906221a501b9e (patch) | |
tree | 118373450e3e844cbad613fb417df1a95b47dfa3 | |
parent | fe3bc4e33195c3bb931d2a4a0b392696a14a1b9a (diff) |
Throw nice error if server is too old to support psql's \ef or \sf command.
Previously, you'd get "function pg_catalog.pg_get_functiondef(integer) does
not exist", which is at best rather unprofessional-looking. Back-patch
to 8.4 where \ef was introduced.
Josh Kupershmidt
-rw-r--r-- | src/bin/psql/command.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c index 1339f336ff0..786f4139b53 100644 --- a/src/bin/psql/command.c +++ b/src/bin/psql/command.c @@ -492,7 +492,13 @@ exec_command(const char *cmd, */ else if (strcmp(cmd, "ef") == 0) { - if (!query_buf) + 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; |