diff options
author | Bruce Momjian <bruce@momjian.us> | 2010-09-28 21:41:03 +0000 |
---|---|---|
committer | Bruce Momjian <bruce@momjian.us> | 2010-09-28 21:41:03 +0000 |
commit | 9340fb80b1dba5528c0d16b24985369659a19377 (patch) | |
tree | 9f4fd6fd6b30a6f694a88156baefe445e385aad5 /contrib/pg_upgrade/info.c | |
parent | a1bb570de97c71eba3c1b7a067063e8ba28c41d5 (diff) |
In pg_upgrade, properly handle oids > 2^31 by using strtoul() internally
rather than atol().
Per report from Brian Hirt
Diffstat (limited to 'contrib/pg_upgrade/info.c')
-rw-r--r-- | contrib/pg_upgrade/info.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/contrib/pg_upgrade/info.c b/contrib/pg_upgrade/info.c index 1601d56b081..55489ac1aa9 100644 --- a/contrib/pg_upgrade/info.c +++ b/contrib/pg_upgrade/info.c @@ -242,7 +242,7 @@ get_db_infos(migratorContext *ctx, DbInfoArr *dbinfs_arr, Cluster whichCluster) for (tupnum = 0; tupnum < ntups; tupnum++) { - dbinfos[tupnum].db_oid = atol(PQgetvalue(res, tupnum, i_oid)); + dbinfos[tupnum].db_oid = str2uint(PQgetvalue(res, tupnum, i_oid)); snprintf(dbinfos[tupnum].db_name, sizeof(dbinfos[tupnum].db_name), "%s", PQgetvalue(res, tupnum, i_datname)); @@ -360,7 +360,7 @@ get_rel_infos(migratorContext *ctx, const DbInfo *dbinfo, RelInfo *curr = &relinfos[num_rels++]; const char *tblspace; - curr->reloid = atol(PQgetvalue(res, relnum, i_oid)); + curr->reloid = str2uint(PQgetvalue(res, relnum, i_oid)); nspname = PQgetvalue(res, relnum, i_nspname); strlcpy(curr->nspname, nspname, sizeof(curr->nspname)); @@ -368,8 +368,8 @@ get_rel_infos(migratorContext *ctx, const DbInfo *dbinfo, relname = PQgetvalue(res, relnum, i_relname); strlcpy(curr->relname, relname, sizeof(curr->relname)); - curr->relfilenode = atol(PQgetvalue(res, relnum, i_relfilenode)); - curr->toastrelid = atol(PQgetvalue(res, relnum, i_reltoastrelid)); + curr->relfilenode = str2uint(PQgetvalue(res, relnum, i_relfilenode)); + curr->toastrelid = str2uint(PQgetvalue(res, relnum, i_reltoastrelid)); tblspace = PQgetvalue(res, relnum, i_spclocation); /* if no table tablespace, use the database tablespace */ |