| 2151 | } |
| 2152 | |
| 2153 | static Oid |
| 2154 | findTypeOutputFunction(List *procname, Oid typeOid) |
| 2155 | { |
| 2156 | Oid argList[1]; |
| 2157 | Oid procOid; |
| 2158 | |
| 2159 | /* |
| 2160 | * Output functions always take a single argument of the type and return |
| 2161 | * cstring. |
| 2162 | */ |
| 2163 | argList[0] = typeOid; |
| 2164 | |
| 2165 | procOid = LookupFuncName(procname, 1, argList, true); |
| 2166 | if (!OidIsValid(procOid)) |
| 2167 | ereport(ERROR, |
| 2168 | (errcode(ERRCODE_UNDEFINED_FUNCTION), |
| 2169 | errmsg("function %s does not exist", |
| 2170 | func_signature_string(procname, 1, NIL, argList)))); |
| 2171 | |
| 2172 | if (get_func_rettype(procOid) != CSTRINGOID) |
| 2173 | ereport(ERROR, |
| 2174 | (errcode(ERRCODE_INVALID_OBJECT_DEFINITION), |
| 2175 | errmsg("type output function %s must return type %s", |
| 2176 | NameListToString(procname), "cstring"))); |
| 2177 | |
| 2178 | /* Just a warning for now, per comments in findTypeInputFunction */ |
| 2179 | if (func_volatile(procOid) == PROVOLATILE_VOLATILE) |
| 2180 | ereport(WARNING, |
| 2181 | (errcode(ERRCODE_INVALID_OBJECT_DEFINITION), |
| 2182 | errmsg("type output function %s should not be volatile", |
| 2183 | NameListToString(procname)))); |
| 2184 | |
| 2185 | return procOid; |
| 2186 | } |
| 2187 | |
| 2188 | static Oid |
| 2189 | findTypeReceiveFunction(List *procname, Oid typeOid) |
no test coverage detected