| 379 | } |
| 380 | |
| 381 | static int |
| 382 | GetForeignTableSegNumbers(Oid relid) |
| 383 | { |
| 384 | Relation foreignTableRel; |
| 385 | ScanKeyData ftkey; |
| 386 | SysScanDesc ftscan; |
| 387 | int number = 0; |
| 388 | |
| 389 | |
| 390 | foreignTableRel = table_open(ForeignTableRelationSegId, AccessShareLock); |
| 391 | |
| 392 | ScanKeyInit(&ftkey, |
| 393 | Anum_pg_foreign_table_seg_ftsrelid, |
| 394 | BTEqualStrategyNumber, F_OIDEQ, |
| 395 | ObjectIdGetDatum(relid)); |
| 396 | |
| 397 | ftscan = systable_beginscan(foreignTableRel, InvalidOid, |
| 398 | false, NULL, 1, &ftkey); |
| 399 | |
| 400 | while (HeapTupleIsValid(systable_getnext(ftscan))) |
| 401 | { |
| 402 | number++; |
| 403 | } |
| 404 | |
| 405 | systable_endscan(ftscan); |
| 406 | |
| 407 | table_close(foreignTableRel, AccessShareLock); |
| 408 | |
| 409 | return number; |
| 410 | } |
| 411 | |
| 412 | static ForeignTable * |
| 413 | GetForeignTableOnSegment(Oid relid) |
no test coverage detected