* Convert the text-array format of reloptions into a List of DefElem. * This is the inverse of transformRelOptions(). */
| 1358 | * This is the inverse of transformRelOptions(). |
| 1359 | */ |
| 1360 | List * |
| 1361 | untransformRelOptions(Datum options) |
| 1362 | { |
| 1363 | List *result = NIL; |
| 1364 | ArrayType *array; |
| 1365 | Datum *optiondatums; |
| 1366 | int noptions; |
| 1367 | int i; |
| 1368 | |
| 1369 | /* Nothing to do if no options */ |
| 1370 | if (!PointerIsValid(DatumGetPointer(options))) |
| 1371 | return result; |
| 1372 | |
| 1373 | array = DatumGetArrayTypeP(options); |
| 1374 | |
| 1375 | deconstruct_array(array, TEXTOID, -1, false, TYPALIGN_INT, |
| 1376 | &optiondatums, NULL, &noptions); |
| 1377 | |
| 1378 | for (i = 0; i < noptions; i++) |
| 1379 | { |
| 1380 | char *s; |
| 1381 | char *p; |
| 1382 | Node *val = NULL; |
| 1383 | |
| 1384 | s = TextDatumGetCString(optiondatums[i]); |
| 1385 | p = strchr(s, '='); |
| 1386 | if (p) |
| 1387 | { |
| 1388 | *p++ = '\0'; |
| 1389 | val = (Node *) makeString(pstrdup(p)); |
| 1390 | } |
| 1391 | result = lappend(result, makeDefElem(pstrdup(s), val, -1)); |
| 1392 | } |
| 1393 | |
| 1394 | return result; |
| 1395 | } |
| 1396 | |
| 1397 | /* |
| 1398 | * Extract and parse reloptions from a pg_class tuple. |
no test coverage detected