* getFormattedOperatorName - retrieve the operator name for the * given operator OID (presented in string form). * * Returns an allocated string, or NULL if the given OID is invalid. * Caller is responsible for free'ing result string. * * What we produce has the format "OPERATOR(schema.oprname)". This is only * useful in commands where the operator's argument types can be inferred from *
| 14442 | * are in different schemas. |
| 14443 | */ |
| 14444 | static char * |
| 14445 | getFormattedOperatorName(const char *oproid) |
| 14446 | { |
| 14447 | OprInfo *oprInfo; |
| 14448 | |
| 14449 | /* In all cases "0" means a null reference */ |
| 14450 | if (strcmp(oproid, "0") == 0) |
| 14451 | return NULL; |
| 14452 | |
| 14453 | oprInfo = findOprByOid(atooid(oproid)); |
| 14454 | if (oprInfo == NULL) |
| 14455 | { |
| 14456 | pg_log_warning("could not find operator with OID %s", |
| 14457 | oproid); |
| 14458 | return NULL; |
| 14459 | } |
| 14460 | |
| 14461 | return psprintf("OPERATOR(%s.%s)", |
| 14462 | fmtId(oprInfo->dobj.namespace->dobj.name), |
| 14463 | oprInfo->dobj.name); |
| 14464 | } |
| 14465 | |
| 14466 | /* |
| 14467 | * Convert a function OID obtained from pg_ts_parser or pg_ts_template |
no test coverage detected