* GetDatabasePath - construct path to a database directory * * Result is a palloc'd string. * * XXX this must agree with GetRelationPath()! */
| 107 | * XXX this must agree with GetRelationPath()! |
| 108 | */ |
| 109 | char * |
| 110 | GetDatabasePath(Oid dbNode, Oid spcNode) |
| 111 | { |
| 112 | if (spcNode == GLOBALTABLESPACE_OID) |
| 113 | { |
| 114 | /* Shared system relations live in {datadir}/global */ |
| 115 | Assert(dbNode == 0); |
| 116 | return pstrdup("global"); |
| 117 | } |
| 118 | else if (spcNode == DEFAULTTABLESPACE_OID) |
| 119 | { |
| 120 | /* The default tablespace is {datadir}/base */ |
| 121 | return psprintf("base/%u", dbNode); |
| 122 | } |
| 123 | else |
| 124 | { |
| 125 | /* All other tablespaces are accessed via symlinks */ |
| 126 | return psprintf("pg_tblspc/%u/%s/%u", |
| 127 | spcNode, GP_TABLESPACE_VERSION_DIRECTORY, dbNode); |
| 128 | } |
| 129 | } |
| 130 | |
| 131 | /* |
| 132 | * GetRelationPath - construct path to a relation's file |
no test coverage detected