Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 106f26a

Browse files
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/41AB5F1F-4389-4B25-9668-5C430375836C@yesql.se
1 parent 4c8044c commit 106f26a

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/bin/pg_upgrade/check.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -568,7 +568,7 @@ check_is_install_user(ClusterInfo *cluster)
568568
* users might match users defined in the old cluster and generate an
569569
* error during pg_dump restore.
570570
*/
571-
if (cluster == &new_cluster && atooid(PQgetvalue(res, 0, 0)) != 1)
571+
if (cluster == &new_cluster && strcmp(PQgetvalue(res, 0, 0), "1") != 0)
572572
pg_fatal("Only the install user can be defined in the new cluster.");
573573

574574
PQclear(res);

0 commit comments

Comments
 (0)