Skip to content

Commit 6507626

Browse files
committed
Make a no-op ALTER EXTENSION UPDATE give just a NOTICE, not ERROR.
This seems a bit more user-friendly.
1 parent b4a7e59 commit 6507626

File tree

1 file changed

+17
-5
lines changed

1 file changed

+17
-5
lines changed

src/backend/commands/extension.c

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1035,11 +1035,6 @@ identify_update_path(ExtensionControlFile *control,
10351035
ExtensionVersionInfo *evi_start;
10361036
ExtensionVersionInfo *evi_target;
10371037

1038-
if (strcmp(oldVersion, newVersion) == 0)
1039-
ereport(ERROR,
1040-
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
1041-
errmsg("version to install or update to must be different from old version")));
1042-
10431038
/* Extract the version update graph from the script directory */
10441039
evi_list = get_ext_ver_list(control);
10451040

@@ -1262,6 +1257,12 @@ CreateExtension(CreateExtensionStmt *stmt)
12621257
oldVersionName = strVal(d_old_version->arg);
12631258
check_valid_version_name(oldVersionName);
12641259

1260+
if (strcmp(oldVersionName, versionName) == 0)
1261+
ereport(ERROR,
1262+
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
1263+
errmsg("FROM version must be different from installation target version \"%s\"",
1264+
versionName)));
1265+
12651266
updateVersions = identify_update_path(pcontrol,
12661267
oldVersionName,
12671268
versionName);
@@ -2464,6 +2465,17 @@ ExecAlterExtensionStmt(AlterExtensionStmt *stmt)
24642465
}
24652466
check_valid_version_name(versionName);
24662467

2468+
/*
2469+
* If we're already at that version, just say so
2470+
*/
2471+
if (strcmp(oldVersionName, versionName) == 0)
2472+
{
2473+
ereport(NOTICE,
2474+
(errmsg("version \"%s\" of extension \"%s\" is already installed",
2475+
versionName, stmt->extname)));
2476+
return;
2477+
}
2478+
24672479
/*
24682480
* Identify the series of update script files we need to execute
24692481
*/

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy