Commit 36f15dde authored by Jan Wieck's avatar Jan Wieck

Fixed type lookup in spi_prepare for possible qualified

type name specification.

Jan
parent 2f98ece4
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
* ENHANCEMENTS, OR MODIFICATIONS. * ENHANCEMENTS, OR MODIFICATIONS.
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/pl/tcl/pltcl.c,v 1.78 2003/09/14 17:25:54 tgl Exp $ * $Header: /cvsroot/pgsql/src/pl/tcl/pltcl.c,v 1.79 2003/09/29 19:24:06 wieck Exp $
* *
**********************************************************************/ **********************************************************************/
...@@ -1818,13 +1818,33 @@ pltcl_SPI_prepare(ClientData cdata, Tcl_Interp *interp, ...@@ -1818,13 +1818,33 @@ pltcl_SPI_prepare(ClientData cdata, Tcl_Interp *interp,
************************************************************/ ************************************************************/
for (i = 0; i < nargs; i++) for (i = 0; i < nargs; i++)
{ {
/* XXX should extend this to allow qualified type names */ char *argcopy;
typeTup = typenameType(makeTypeName((char *) args[i])); 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); qdesc->argtypes[i] = HeapTupleGetOid(typeTup);
perm_fmgr_info(((Form_pg_type) GETSTRUCT(typeTup))->typinput, perm_fmgr_info(((Form_pg_type) GETSTRUCT(typeTup))->typinput,
&(qdesc->arginfuncs[i])); &(qdesc->arginfuncs[i]));
qdesc->argtypelems[i] = ((Form_pg_type) GETSTRUCT(typeTup))->typelem; qdesc->argtypelems[i] = ((Form_pg_type) GETSTRUCT(typeTup))->typelem;
ReleaseSysCache(typeTup); ReleaseSysCache(typeTup);
freeList(typename->names);
pfree(typename);
freeList(names);
pfree(argcopy);
} }
/************************************************************ /************************************************************
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment