mirror of
https://github.com/postgres/postgres.git
synced 2026-06-08 16:26:30 -04:00
Fixed type lookup in spi_prepare for possible qualified
type name specification. Jan
This commit is contained in:
parent
2f98ece4de
commit
36f15ddecd
1 changed files with 23 additions and 3 deletions
|
|
@ -31,7 +31,7 @@
|
|||
* ENHANCEMENTS, OR MODIFICATIONS.
|
||||
*
|
||||
* 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,
|
|||
************************************************************/
|
||||
for (i = 0; i < nargs; i++)
|
||||
{
|
||||
/* XXX should extend this to allow qualified type names */
|
||||
typeTup = typenameType(makeTypeName((char *) 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);
|
||||
}
|
||||
|
||||
/************************************************************
|
||||
|
|
|
|||
Loading…
Reference in a new issue