summaryrefslogtreecommitdiff
path: root/src/pl/plperl/plperl.c
diff options
context:
space:
mode:
authorAndrew Dunstan <andrew@dunslane.net>2007-01-27 01:55:57 +0000
committerAndrew Dunstan <andrew@dunslane.net>2007-01-27 01:55:57 +0000
commit175a242187fdd2f2bf233d1feb3c58d4f6c1f9d2 (patch)
treed55320b3371e9f64464cbf94a5708222d5b8c1a1 /src/pl/plperl/plperl.c
parent27552ce5405f0435355e62740be64a34b84b6aca (diff)
Allow args to spi_prepare to be standard type aliaes as well as those known in pg_type. Fixes bug #2917. Add some regression tests for these cases.
Diffstat (limited to 'src/pl/plperl/plperl.c')
-rw-r--r--src/pl/plperl/plperl.c28
1 files changed, 14 insertions, 14 deletions
diff --git a/src/pl/plperl/plperl.c b/src/pl/plperl/plperl.c
index e0bbe8fbabf..303024dd70d 100644
--- a/src/pl/plperl/plperl.c
+++ b/src/pl/plperl/plperl.c
@@ -1,7 +1,7 @@
/**********************************************************************
* plperl.c - perl as a procedural language for PostgreSQL
*
- * $PostgreSQL: pgsql/src/pl/plperl/plperl.c,v 1.123 2006/11/21 16:59:02 adunstan Exp $
+ * $PostgreSQL: pgsql/src/pl/plperl/plperl.c,v 1.124 2007/01/27 01:55:57 adunstan Exp $
*
**********************************************************************/
@@ -2128,23 +2128,23 @@ plperl_spi_prepare(char *query, int argc, SV **argv)
PG_TRY();
{
/************************************************************
- * Lookup the argument types by name in the system cache
- * and remember the required information for input conversion
+ * Resolve argument type names and then look them up by oid
+ * in the system cache, and remember the required information
+ * for input conversion.
************************************************************/
for (i = 0; i < argc; i++)
{
- List *names;
- HeapTuple typeTup;
-
- /* Parse possibly-qualified type name and look it up in pg_type */
- names = stringToQualifiedNameList(SvPV(argv[i], PL_na),
- "plperl_spi_prepare");
- typeTup = typenameType(NULL, makeTypeNameFromNameList(names));
- qdesc->argtypes[i] = HeapTupleGetOid(typeTup);
- perm_fmgr_info(((Form_pg_type) GETSTRUCT(typeTup))->typinput,
+ Oid typId, typInput, typIOParam;
+ int32 typmod;
+
+ parseTypeString(SvPV(argv[i], PL_na), &typId, &typmod);
+
+ getTypeInputInfo(typId, &typInput, &typIOParam);
+
+ qdesc->argtypes[i] = typId;
+ perm_fmgr_info((Form_pg_type) typInput,
&(qdesc->arginfuncs[i]));
- qdesc->argtypioparams[i] = getTypeIOParam(typeTup);
- ReleaseSysCache(typeTup);
+ qdesc->argtypioparams[i] = typIOParam;
}
/************************************************************