Skip to content

Commit 700a1a6

Browse files
committed
More explicit error message if the version functions are not found
1 parent 0e74882 commit 700a1a6

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

bin/pg_repack.c

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,7 @@ static bool kill_ddl(PGconn *conn, Oid relid, bool terminate);
186186
static bool lock_access_share(PGconn *conn, Oid relid, const char *target_name);
187187

188188
#define SQLSTATE_INVALID_SCHEMA_NAME "3F000"
189+
#define SQLSTATE_UNDEFINED_FUNCTION "42883"
189190
#define SQLSTATE_QUERY_CANCELED "57014"
190191

191192
static bool sqlstate_equals(PGresult *res, const char *state)
@@ -477,12 +478,16 @@ repack_one_database(const char *orderby, char *errbuf, size_t errsize)
477478
}
478479
else
479480
{
480-
if (sqlstate_equals(res, SQLSTATE_INVALID_SCHEMA_NAME))
481+
if (sqlstate_equals(res, SQLSTATE_INVALID_SCHEMA_NAME)
482+
|| sqlstate_equals(res, SQLSTATE_UNDEFINED_FUNCTION))
481483
{
482-
/* Schema repack does not exist. Skip the database. */
484+
/* Schema repack does not exist, or version too old (version
485+
* functions not found). Skip the database.
486+
*/
483487
if (errbuf)
484488
snprintf(errbuf, errsize,
485-
"%s is not installed in the database", PROGRAM_NAME);
489+
"%s %s is not installed in the database",
490+
PROGRAM_NAME, PROGRAM_VERSION);
486491
}
487492
else
488493
{

0 commit comments

Comments
 (0)