Skip to content

Commit 9b5ca7e

Browse files
committed
Forgot to handle 'opaque' function arguments in regprocedurein/out.
1 parent 9f0ae0c commit 9b5ca7e

File tree

1 file changed

+19
-13
lines changed

1 file changed

+19
-13
lines changed

src/backend/utils/adt/regproc.c

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
*
1414
*
1515
* IDENTIFICATION
16-
* $Header: /cvsroot/pgsql/src/backend/utils/adt/regproc.c,v 1.67 2002/05/01 23:06:41 tgl Exp $
16+
* $Header: /cvsroot/pgsql/src/backend/utils/adt/regproc.c,v 1.68 2002/05/11 00:24:16 tgl Exp $
1717
*
1818
*-------------------------------------------------------------------------
1919
*/
@@ -40,7 +40,7 @@
4040

4141
static List *stringToQualifiedNameList(const char *string, const char *caller);
4242
static void parseNameAndArgTypes(const char *string, const char *caller,
43-
bool allow_none,
43+
const char *type0_spelling,
4444
List **names, int *nargs, Oid *argtypes);
4545

4646

@@ -261,7 +261,7 @@ regprocedurein(PG_FUNCTION_ARGS)
261261
* datatype cannot be used for any system column that needs to receive
262262
* data during bootstrap.
263263
*/
264-
parseNameAndArgTypes(pro_name_or_oid, "regprocedurein", false,
264+
parseNameAndArgTypes(pro_name_or_oid, "regprocedurein", "opaque",
265265
&names, &nargs, argtypes);
266266

267267
clist = FuncnameGetCandidates(names, nargs);
@@ -326,12 +326,16 @@ regprocedureout(PG_FUNCTION_ARGS)
326326
quote_qualified_identifier(nspname, proname));
327327
for (i = 0; i < nargs; i++)
328328
{
329-
appendStringInfo(&buf, "%s%s",
330-
(i > 0) ? "," : "",
331-
format_type_be(procform->proargtypes[i]));
332-
}
329+
Oid thisargtype = procform->proargtypes[i];
333330

334-
appendStringInfo(&buf, ")");
331+
if (i > 0)
332+
appendStringInfoChar(&buf, ',');
333+
if (OidIsValid(thisargtype))
334+
appendStringInfo(&buf, "%s", format_type_be(thisargtype));
335+
else
336+
appendStringInfo(&buf, "opaque");
337+
}
338+
appendStringInfoChar(&buf, ')');
335339

336340
result = buf.data;
337341

@@ -567,7 +571,7 @@ regoperatorin(PG_FUNCTION_ARGS)
567571
* datatype cannot be used for any system column that needs to receive
568572
* data during bootstrap.
569573
*/
570-
parseNameAndArgTypes(opr_name_or_oid, "regoperatorin", true,
574+
parseNameAndArgTypes(opr_name_or_oid, "regoperatorin", "none",
571575
&names, &nargs, argtypes);
572576
if (nargs == 1)
573577
elog(ERROR, "regoperatorin: use NONE to denote the missing argument of a unary operator");
@@ -1000,10 +1004,12 @@ stringToQualifiedNameList(const char *string, const char *caller)
10001004
* the argtypes array should be of size FUNC_MAX_ARGS). The function or
10011005
* operator name is returned to *names as a List of Strings.
10021006
*
1003-
* NONE is accepted as a placeholder for OID 0 if allow_none is true.
1007+
* If type0_spelling is not NULL, it is a name to be accepted as a
1008+
* placeholder for OID 0.
10041009
*/
10051010
static void
1006-
parseNameAndArgTypes(const char *string, const char *caller, bool allow_none,
1011+
parseNameAndArgTypes(const char *string, const char *caller,
1012+
const char *type0_spelling,
10071013
List **names, int *nargs, Oid *argtypes)
10081014
{
10091015
char *rawname;
@@ -1109,9 +1115,9 @@ parseNameAndArgTypes(const char *string, const char *caller, bool allow_none,
11091115
*ptr2 = '\0';
11101116
}
11111117

1112-
if (allow_none && strcasecmp(typename, "none") == 0)
1118+
if (type0_spelling && strcasecmp(typename, type0_spelling) == 0)
11131119
{
1114-
/* Report NONE as OID 0 */
1120+
/* Special case for OPAQUE or NONE */
11151121
typeid = InvalidOid;
11161122
typmod = -1;
11171123
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy