mirror of
https://git.postgresql.org/git/postgresql.git
synced 2024-10-02 03:21:14 +02:00
Use macro atooid() for conversion of strings to oids, per suggestion
from Tom.
This commit is contained in:
parent
5ac144d5c2
commit
807005c024
@ -242,7 +242,7 @@ get_db_infos(migratorContext *ctx, DbInfoArr *dbinfs_arr, Cluster whichCluster)
|
|||||||
|
|
||||||
for (tupnum = 0; tupnum < ntups; tupnum++)
|
for (tupnum = 0; tupnum < ntups; tupnum++)
|
||||||
{
|
{
|
||||||
dbinfos[tupnum].db_oid = str2uint(PQgetvalue(res, tupnum, i_oid));
|
dbinfos[tupnum].db_oid = atooid(PQgetvalue(res, tupnum, i_oid));
|
||||||
|
|
||||||
snprintf(dbinfos[tupnum].db_name, sizeof(dbinfos[tupnum].db_name), "%s",
|
snprintf(dbinfos[tupnum].db_name, sizeof(dbinfos[tupnum].db_name), "%s",
|
||||||
PQgetvalue(res, tupnum, i_datname));
|
PQgetvalue(res, tupnum, i_datname));
|
||||||
@ -360,7 +360,7 @@ get_rel_infos(migratorContext *ctx, const DbInfo *dbinfo,
|
|||||||
RelInfo *curr = &relinfos[num_rels++];
|
RelInfo *curr = &relinfos[num_rels++];
|
||||||
const char *tblspace;
|
const char *tblspace;
|
||||||
|
|
||||||
curr->reloid = str2uint(PQgetvalue(res, relnum, i_oid));
|
curr->reloid = atooid(PQgetvalue(res, relnum, i_oid));
|
||||||
|
|
||||||
nspname = PQgetvalue(res, relnum, i_nspname);
|
nspname = PQgetvalue(res, relnum, i_nspname);
|
||||||
strlcpy(curr->nspname, nspname, sizeof(curr->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);
|
relname = PQgetvalue(res, relnum, i_relname);
|
||||||
strlcpy(curr->relname, relname, sizeof(curr->relname));
|
strlcpy(curr->relname, relname, sizeof(curr->relname));
|
||||||
|
|
||||||
curr->relfilenode = str2uint(PQgetvalue(res, relnum, i_relfilenode));
|
curr->relfilenode = atooid(PQgetvalue(res, relnum, i_relfilenode));
|
||||||
curr->toastrelid = str2uint(PQgetvalue(res, relnum, i_reltoastrelid));
|
curr->toastrelid = atooid(PQgetvalue(res, relnum, i_reltoastrelid));
|
||||||
|
|
||||||
tblspace = PQgetvalue(res, relnum, i_spclocation);
|
tblspace = PQgetvalue(res, relnum, i_spclocation);
|
||||||
/* if no table tablespace, use the database tablespace */
|
/* if no table tablespace, use the database tablespace */
|
||||||
|
@ -52,6 +52,8 @@
|
|||||||
|
|
||||||
#define CLUSTERNAME(cluster) ((cluster) == CLUSTER_OLD ? "old" : "new")
|
#define CLUSTERNAME(cluster) ((cluster) == CLUSTER_OLD ? "old" : "new")
|
||||||
|
|
||||||
|
#define atooid(x) ((Oid) strtoul((x), NULL, 10))
|
||||||
|
|
||||||
/* OID system catalog preservation added during PG 9.0 development */
|
/* OID system catalog preservation added during PG 9.0 development */
|
||||||
#define TABLE_SPACE_SUBDIRS 201001111
|
#define TABLE_SPACE_SUBDIRS 201001111
|
||||||
|
|
||||||
|
@ -94,9 +94,9 @@ get_pg_database_relfilenode(migratorContext *ctx, Cluster whichCluster)
|
|||||||
|
|
||||||
i_relfile = PQfnumber(res, "relfilenode");
|
i_relfile = PQfnumber(res, "relfilenode");
|
||||||
if (whichCluster == CLUSTER_OLD)
|
if (whichCluster == CLUSTER_OLD)
|
||||||
ctx->old.pg_database_oid = str2uint(PQgetvalue(res, 0, i_relfile));
|
ctx->old.pg_database_oid = atooid(PQgetvalue(res, 0, i_relfile));
|
||||||
else
|
else
|
||||||
ctx->new.pg_database_oid = str2uint(PQgetvalue(res, 0, i_relfile));
|
ctx->new.pg_database_oid = atooid(PQgetvalue(res, 0, i_relfile));
|
||||||
|
|
||||||
PQclear(res);
|
PQclear(res);
|
||||||
PQfinish(conn);
|
PQfinish(conn);
|
||||||
|
Loading…
Reference in New Issue
Block a user