aboutsummaryrefslogtreecommitdiff
path: root/src/backend/commands/typecmds.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2005-05-01 18:56:19 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2005-05-01 18:56:19 +0000
commit6c412f0605afeb809014553ff7ad28cf9ed5526b (patch)
tree5540a678c19dcfa1a7023e0f59a970fe2a9a79ee /src/backend/commands/typecmds.c
parentae793ff63cb9167ea6d0f24ca018ffabad157ece (diff)
downloadpostgresql-6c412f0605afeb809014553ff7ad28cf9ed5526b.tar.gz
postgresql-6c412f0605afeb809014553ff7ad28cf9ed5526b.zip
Change CREATE TYPE to require datatype output and send functions to have
only one argument. (Per recent discussion, the option to accept multiple arguments is pretty useless for user-defined types, and would be a likely source of security holes if it was used.) Simplify call sites of output/send functions to not bother passing more than one argument.
Diffstat (limited to 'src/backend/commands/typecmds.c')
-rw-r--r--src/backend/commands/typecmds.c31
1 files changed, 5 insertions, 26 deletions
diff --git a/src/backend/commands/typecmds.c b/src/backend/commands/typecmds.c
index 1ec9621000e..0e83c14cdf6 100644
--- a/src/backend/commands/typecmds.c
+++ b/src/backend/commands/typecmds.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/commands/typecmds.c,v 1.70 2005/04/14 20:03:24 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/commands/typecmds.c,v 1.71 2005/05/01 18:56:18 tgl Exp $
*
* DESCRIPTION
* The "DefineFoo" routines take the parse tree and pick out the
@@ -920,12 +920,11 @@ findTypeInputFunction(List *procname, Oid typeOid)
static Oid
findTypeOutputFunction(List *procname, Oid typeOid)
{
- Oid argList[2];
+ Oid argList[1];
Oid procOid;
/*
- * Output functions can take a single argument of the type, or two
- * arguments (data value, element OID).
+ * Output functions can take a single argument of the type.
*
* For backwards compatibility we allow OPAQUE in place of the actual
* type name; if we see this, we issue a warning and fix up the
@@ -937,24 +936,11 @@ findTypeOutputFunction(List *procname, Oid typeOid)
if (OidIsValid(procOid))
return procOid;
- argList[1] = OIDOID;
-
- procOid = LookupFuncName(procname, 2, argList, true);
- if (OidIsValid(procOid))
- return procOid;
-
/* No luck, try it with OPAQUE */
argList[0] = OPAQUEOID;
procOid = LookupFuncName(procname, 1, argList, true);
- if (!OidIsValid(procOid))
- {
- argList[1] = OIDOID;
-
- procOid = LookupFuncName(procname, 2, argList, true);
- }
-
if (OidIsValid(procOid))
{
/* Found, but must complain and fix the pg_proc entry */
@@ -1016,12 +1002,11 @@ findTypeReceiveFunction(List *procname, Oid typeOid)
static Oid
findTypeSendFunction(List *procname, Oid typeOid)
{
- Oid argList[2];
+ Oid argList[1];
Oid procOid;
/*
- * Send functions can take a single argument of the type, or two
- * arguments (data value, element OID).
+ * Send functions can take a single argument of the type.
*/
argList[0] = typeOid;
@@ -1029,12 +1014,6 @@ findTypeSendFunction(List *procname, Oid typeOid)
if (OidIsValid(procOid))
return procOid;
- argList[1] = OIDOID;
-
- procOid = LookupFuncName(procname, 2, argList, true);
- if (OidIsValid(procOid))
- return procOid;
-
ereport(ERROR,
(errcode(ERRCODE_UNDEFINED_FUNCTION),
errmsg("function %s does not exist",