* Like GetExtTableEntry(Oid), but returns NULL instead of throwing * an error if no pg_foreign_table entry is found. */
| 178 | * an error if no pg_foreign_table entry is found. |
| 179 | */ |
| 180 | ExtTableEntry* |
| 181 | GetExtTableEntryIfExists(Oid relid) |
| 182 | { |
| 183 | ForeignTable *ft; |
| 184 | ExtTableEntry *extentry; |
| 185 | |
| 186 | /* do nothing if it's not an external table */ |
| 187 | if (!rel_is_external_table(relid)) |
| 188 | return NULL; |
| 189 | |
| 190 | ft = GetForeignTable(relid); |
| 191 | |
| 192 | /* options array is always populated, {} if no options set */ |
| 193 | if (ft->options == NULL) |
| 194 | elog(ERROR, "could not find options for external protocol"); |
| 195 | |
| 196 | extentry = GetExtFromForeignTableOptions(ft->options, relid); |
| 197 | |
| 198 | pfree(ft); |
| 199 | |
| 200 | return extentry; |
| 201 | } |
| 202 | |
| 203 | ExtTableEntry * |
| 204 | GetExtFromForeignTableOptions(List *ftoptons, Oid relid) |
no test coverage detected