* Subroutine for ALTER FUNCTION/AGGREGATE SET SCHEMA/RENAME * * Is there a function with the given name and signature already in the given * namespace? If so, raise an appropriate error message. */
| 2563 | * namespace? If so, raise an appropriate error message. |
| 2564 | */ |
| 2565 | void |
| 2566 | IsThereFunctionInNamespace(const char *proname, int pronargs, |
| 2567 | oidvector *proargtypes, Oid nspOid) |
| 2568 | { |
| 2569 | /* check for duplicate name (more friendly than unique-index failure) */ |
| 2570 | if (SearchSysCacheExists3(PROCNAMEARGSNSP, |
| 2571 | CStringGetDatum(proname), |
| 2572 | PointerGetDatum(proargtypes), |
| 2573 | ObjectIdGetDatum(nspOid))) |
| 2574 | ereport(ERROR, |
| 2575 | (errcode(ERRCODE_DUPLICATE_FUNCTION), |
| 2576 | errmsg("function %s already exists in schema \"%s\"", |
| 2577 | funcname_signature_string(proname, pronargs, |
| 2578 | NIL, proargtypes->values), |
| 2579 | get_namespace_name(nspOid)))); |
| 2580 | } |
| 2581 | |
| 2582 | /* |
| 2583 | * ExecuteDoStmt |
no test coverage detected