summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Gustafsson2023-03-21 11:57:21 +0000
committerDaniel Gustafsson2023-03-21 11:57:21 +0000
commit106f26a849bbb760a270e9a3c586aeb73899e26a (patch)
treec178eabcbe0fd09545d66c9b657c1c192ae31031
parent4c8044c04455fe87dadefa4f7c69bfe6cdbe3cc5 (diff)
Avoid using atooid for numerical comparisons which arent Oids
The check for the number of roles in the target cluster for an upgrade selects the existing roles and performs a COUNT(*) over the result. A value of one is the expected query result value indicating that only the install user is present in the new cluster. The result was converted with the function for converting a string containing an Oid into a numeric, which avoids potential overflow but makes the code less readable since it's not actually an Oid at all. Discussion: https://postgr.es/m/[email protected]
-rw-r--r--src/bin/pg_upgrade/check.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/bin/pg_upgrade/check.c b/src/bin/pg_upgrade/check.c
index b71b00be37..fea159689e 100644
--- a/src/bin/pg_upgrade/check.c
+++ b/src/bin/pg_upgrade/check.c
@@ -568,7 +568,7 @@ check_is_install_user(ClusterInfo *cluster)
* users might match users defined in the old cluster and generate an
* error during pg_dump restore.
*/
- if (cluster == &new_cluster && atooid(PQgetvalue(res, 0, 0)) != 1)
+ if (cluster == &new_cluster && strcmp(PQgetvalue(res, 0, 0), "1") != 0)
pg_fatal("Only the install user can be defined in the new cluster.");
PQclear(res);