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

Commit6f3dc00

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 parent788cb1c commit6f3dc00

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;
@@ -1115,7 +1121,13 @@ exec_command(const char *cmd,
11151121
func_buf=createPQExpBuffer();
11161122
func=psql_scan_slash_option(scan_state,
11171123
OT_WHOLE_LINE,NULL, true);
1118-
if (!func)
1124+
if (pset.sversion<80400)
1125+
{
1126+
psql_error("The server (version %d.%d) does not support showing function source.\n",
1127+
pset.sversion /10000, (pset.sversion /100) %100);
1128+
status=PSQL_CMD_ERROR;
1129+
}
1130+
elseif (!func)
11191131
{
11201132
psql_error("function name is required\n");
11211133
status=PSQL_CMD_ERROR;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp