char *relpath(RelFileNode r)
{
char *path = malloc(ENOUGH_SPACE);
if (r.spcNode == GLOBALTABLESPACE_OID) {
Assert(r.dbNode == 0);
sprintf(path, "%s/global/%u",
DataDir, r.relNode);
}
else if (r.spcNode == DEFAULTTABLESPACE_OID) {
sprintf(path, "%s/base/%u/%u",
DataDir, r.dbNode, r.relNode);
}
else {
sprintf(path, "%s/pg_tblspc/%u/%u/%u", DataDir
r.spcNode, r.dbNode, r.relNode);
}
return path;
}
|