Get and separate out the num_segments option */
| 85 | |
| 86 | /* Get and separate out the num_segments option */ |
| 87 | int32 |
| 88 | SeparateOutNumSegments(List **options) |
| 89 | { |
| 90 | ListCell *lc = NULL; |
| 91 | char *num_segments_str = NULL; |
| 92 | int32 num_segments = 0; |
| 93 | |
| 94 | foreach(lc, *options) |
| 95 | { |
| 96 | DefElem *def = (DefElem *) lfirst(lc); |
| 97 | |
| 98 | if (strcmp(def->defname, "num_segments") == 0) |
| 99 | { |
| 100 | num_segments_str = defGetString(def); |
| 101 | num_segments = pg_atoi(num_segments_str, sizeof(int32), 0); |
| 102 | |
| 103 | if (num_segments <= 0) |
| 104 | { |
| 105 | ereport(ERROR, |
| 106 | (errcode(ERRCODE_SYNTAX_ERROR), |
| 107 | errmsg("\"%d\" is not a valid num_segments value", |
| 108 | num_segments))); |
| 109 | } |
| 110 | |
| 111 | *options = list_delete_cell(*options, lc); |
| 112 | break; |
| 113 | } |
| 114 | } |
| 115 | return num_segments; |
| 116 | } |
| 117 | |
| 118 | /* |
| 119 | * GetForeignDataWrapper - look up the foreign-data wrapper by OID. |
no test coverage detected