* Gets the TupleDesc for a Ephemeral Named Relation, based on which field was * filled. * * When the TupleDesc is based on a relation from the catalogs, we count on * that relation being used at the same time, so that appropriate locks will * already be held. Locking here would be too late anyway. */
| 230 | * already be held. Locking here would be too late anyway. |
| 231 | */ |
| 232 | TupleDesc |
| 233 | ENRMetadataGetTupDesc(EphemeralNamedRelationMetadata enrmd) |
| 234 | { |
| 235 | TupleDesc tupdesc; |
| 236 | |
| 237 | /* not only one, but use reliddesc field first. */ |
| 238 | Assert(enrmd->reliddesc || enrmd->tupdesc); |
| 239 | |
| 240 | if (enrmd->tupdesc != NULL) |
| 241 | tupdesc = enrmd->tupdesc; |
| 242 | else |
| 243 | { |
| 244 | Relation relation; |
| 245 | |
| 246 | relation = table_open(enrmd->reliddesc, NoLock); |
| 247 | tupdesc = relation->rd_att; |
| 248 | table_close(relation, NoLock); |
| 249 | } |
| 250 | |
| 251 | return tupdesc; |
| 252 | } |
no test coverage detected