summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2011-11-10 18:37:00 -0500
committerTom Lane <tgl@sss.pgh.pa.us>2011-11-10 18:37:00 -0500
commitc49130ade4dac5d8dff724cf15b0f0cdb9cf7d24 (patch)
treec83d276862aad9e64f443b89e7f2b6afed622b4a /src
parent019d45e13910a03fbd2f71293175b4ce09dcf0a7 (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
Diffstat (limited to 'src')
-rw-r--r--src/bin/psql/command.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 7c44faeb2c6..98548d36551 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -508,7 +508,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;