*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/adt/regproc.c,v 1.67 2002/05/01 23:06:41 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/adt/regproc.c,v 1.68 2002/05/11 00:24:16 tgl Exp $
*
*-------------------------------------------------------------------------
*/
static List *stringToQualifiedNameList(const char *string, const char *caller);
static void parseNameAndArgTypes(const char *string, const char *caller,
- bool allow_none,
+ const char *type0_spelling,
List **names, int *nargs, Oid *argtypes);
* datatype cannot be used for any system column that needs to receive
* data during bootstrap.
*/
- parseNameAndArgTypes(pro_name_or_oid, "regprocedurein", false,
+ parseNameAndArgTypes(pro_name_or_oid, "regprocedurein", "opaque",
&names, &nargs, argtypes);
clist = FuncnameGetCandidates(names, nargs);
quote_qualified_identifier(nspname, proname));
for (i = 0; i < nargs; i++)
{
- appendStringInfo(&buf, "%s%s",
- (i > 0) ? "," : "",
- format_type_be(procform->proargtypes[i]));
- }
+ Oid thisargtype = procform->proargtypes[i];
- appendStringInfo(&buf, ")");
+ if (i > 0)
+ appendStringInfoChar(&buf, ',');
+ if (OidIsValid(thisargtype))
+ appendStringInfo(&buf, "%s", format_type_be(thisargtype));
+ else
+ appendStringInfo(&buf, "opaque");
+ }
+ appendStringInfoChar(&buf, ')');
result = buf.data;
* datatype cannot be used for any system column that needs to receive
* data during bootstrap.
*/
- parseNameAndArgTypes(opr_name_or_oid, "regoperatorin", true,
+ parseNameAndArgTypes(opr_name_or_oid, "regoperatorin", "none",
&names, &nargs, argtypes);
if (nargs == 1)
elog(ERROR, "regoperatorin: use NONE to denote the missing argument of a unary operator");
* the argtypes array should be of size FUNC_MAX_ARGS). The function or
* operator name is returned to *names as a List of Strings.
*
- * NONE is accepted as a placeholder for OID 0 if allow_none is true.
+ * If type0_spelling is not NULL, it is a name to be accepted as a
+ * placeholder for OID 0.
*/
static void
-parseNameAndArgTypes(const char *string, const char *caller, bool allow_none,
+parseNameAndArgTypes(const char *string, const char *caller,
+ const char *type0_spelling,
List **names, int *nargs, Oid *argtypes)
{
char *rawname;
*ptr2 = '\0';
}
- if (allow_none && strcasecmp(typename, "none") == 0)
+ if (type0_spelling && strcasecmp(typename, type0_spelling) == 0)
{
- /* Report NONE as OID 0 */
+ /* Special case for OPAQUE or NONE */
typeid = InvalidOid;
typmod = -1;
}