Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit07d5205

Browse files
committed
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) doesnot exist", which is at best rather unprofessional-looking. Back-patchto 8.4 where \ef was introduced.Josh Kupershmidt
1 parent91e8cb6 commit07d5205

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

‎src/bin/psql/command.c

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -583,7 +583,13 @@ exec_command(const char *cmd,
583583
{
584584
intlineno=-1;
585585

586-
if (!query_buf)
586+
if (pset.sversion<80400)
587+
{
588+
psql_error("The server (version %d.%d) does not support editing function source.\n",
589+
pset.sversion /10000, (pset.sversion /100) %100);
590+
status=PSQL_CMD_ERROR;
591+
}
592+
elseif (!query_buf)
587593
{
588594
psql_error("no query buffer\n");
589595
status=PSQL_CMD_ERROR;
@@ -1110,7 +1116,13 @@ exec_command(const char *cmd,
11101116
func_buf=createPQExpBuffer();
11111117
func=psql_scan_slash_option(scan_state,
11121118
OT_WHOLE_LINE,NULL, true);
1113-
if (!func)
1119+
if (pset.sversion<80400)
1120+
{
1121+
psql_error("The server (version %d.%d) does not support showing function source.\n",
1122+
pset.sversion /10000, (pset.sversion /100) %100);
1123+
status=PSQL_CMD_ERROR;
1124+
}
1125+
elseif (!func)
11141126
{
11151127
psql_error("function name is required\n");
11161128
status=PSQL_CMD_ERROR;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp