summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Wieck2003-10-30 02:00:44 +0000
committerJan Wieck2003-10-30 02:00:44 +0000
commit9e692f230737cacfda83efc7a7bda522501c2bf9 (patch)
tree616e268882e5543fe806927232cf8194e7bc0370
parent0847c879a91792ff51da08a6fd15a565935f8741 (diff)
Support for qualified type names in PL/Tcl's spi_prepare command.
This is not 100% backward compatible as formerly a double quoted type name containing a dot could be used. But I don't think may people use dot's in the name of user defined types. Jan
-rw-r--r--src/pl/tcl/pltcl.c26
1 files changed, 23 insertions, 3 deletions
diff --git a/src/pl/tcl/pltcl.c b/src/pl/tcl/pltcl.c
index e6d8c186d5b..56f05660413 100644
--- a/src/pl/tcl/pltcl.c
+++ b/src/pl/tcl/pltcl.c
@@ -31,7 +31,7 @@
* ENHANCEMENTS, OR MODIFICATIONS.
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/pl/tcl/pltcl.c,v 1.66.2.3 2003/05/16 13:37:11 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/pl/tcl/pltcl.c,v 1.66.2.4 2003/10/30 02:00:44 wieck Exp $
*
**********************************************************************/
@@ -1777,13 +1777,33 @@ pltcl_SPI_prepare(ClientData cdata, Tcl_Interp *interp,
************************************************************/
for (i = 0; i < nargs; i++)
{
- /* XXX should extend this to allow qualified type names */
- typeTup = typenameType(makeTypeName(args[i]));
+ char *argcopy;
+ List *names = NIL;
+ List *lp;
+ TypeName *typename;
+
+ /************************************************************
+ * Use SplitIdentifierString() on a copy of the type name,
+ * turn the resulting pointer list into a TypeName node
+ * and call typenameType() to get the pg_type tuple.
+ ************************************************************/
+ argcopy = pstrdup(args[i]);
+ SplitIdentifierString(argcopy, '.', &names);
+ typename = makeNode(TypeName);
+ foreach (lp, names)
+ typename->names = lappend(typename->names, makeString(lfirst(lp)));
+
+ typeTup = typenameType(typename);
qdesc->argtypes[i] = HeapTupleGetOid(typeTup);
perm_fmgr_info(((Form_pg_type) GETSTRUCT(typeTup))->typinput,
&(qdesc->arginfuncs[i]));
qdesc->argtypelems[i] = ((Form_pg_type) GETSTRUCT(typeTup))->typelem;
ReleaseSysCache(typeTup);
+
+ freeList(typename->names);
+ pfree(typename);
+ freeList(names);
+ pfree(argcopy);
}
/************************************************************