---------- * plpgsql_parse_word The scanner calls this to postparse * any single word that is not a reserved keyword. * * word1 is the downcased/dequoted identifier; it must be palloc'd in the * function's long-term memory context. * * yytxt is the original token text; we need this to check for quoting, * so that later checks for unreserved keywords work properly. * * We attempt to r
| 1412 | * ---------- |
| 1413 | */ |
| 1414 | bool |
| 1415 | plpgsql_parse_word(char *word1, const char *yytxt, bool lookup, |
| 1416 | PLwdatum *wdatum, PLword *word) |
| 1417 | { |
| 1418 | PLpgSQL_nsitem *ns; |
| 1419 | |
| 1420 | /* |
| 1421 | * We should not lookup variables in DECLARE sections. In SQL |
| 1422 | * expressions, there's no need to do so either --- lookup will happen |
| 1423 | * when the expression is compiled. |
| 1424 | */ |
| 1425 | if (lookup && plpgsql_IdentifierLookup == IDENTIFIER_LOOKUP_NORMAL) |
| 1426 | { |
| 1427 | /* |
| 1428 | * Do a lookup in the current namespace stack |
| 1429 | */ |
| 1430 | ns = plpgsql_ns_lookup(plpgsql_ns_top(), false, |
| 1431 | word1, NULL, NULL, |
| 1432 | NULL); |
| 1433 | |
| 1434 | if (ns != NULL) |
| 1435 | { |
| 1436 | switch (ns->itemtype) |
| 1437 | { |
| 1438 | case PLPGSQL_NSTYPE_VAR: |
| 1439 | case PLPGSQL_NSTYPE_REC: |
| 1440 | wdatum->datum = plpgsql_Datums[ns->itemno]; |
| 1441 | wdatum->ident = word1; |
| 1442 | wdatum->quoted = (yytxt[0] == '"'); |
| 1443 | wdatum->idents = NIL; |
| 1444 | return true; |
| 1445 | |
| 1446 | default: |
| 1447 | /* plpgsql_ns_lookup should never return anything else */ |
| 1448 | elog(ERROR, "unrecognized plpgsql itemtype: %d", |
| 1449 | ns->itemtype); |
| 1450 | } |
| 1451 | } |
| 1452 | } |
| 1453 | |
| 1454 | /* |
| 1455 | * Nothing found - up to now it's a word without any special meaning for |
| 1456 | * us. |
| 1457 | */ |
| 1458 | word->ident = word1; |
| 1459 | word->quoted = (yytxt[0] == '"'); |
| 1460 | return false; |
| 1461 | } |
| 1462 | |
| 1463 | |
| 1464 | /* ---------- |
no test coverage detected