Skip to content

Commit 36f15dd

Browse files
Jan WieckJan Wieck
authored andcommitted
Fixed type lookup in spi_prepare for possible qualified
type name specification. Jan
1 parent 2f98ece commit 36f15dd

File tree

1 file changed

+23
-3
lines changed

1 file changed

+23
-3
lines changed

src/pl/tcl/pltcl.c

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
* ENHANCEMENTS, OR MODIFICATIONS.
3232
*
3333
* IDENTIFICATION
34-
* $Header: /cvsroot/pgsql/src/pl/tcl/pltcl.c,v 1.78 2003/09/14 17:25:54 tgl Exp $
34+
* $Header: /cvsroot/pgsql/src/pl/tcl/pltcl.c,v 1.79 2003/09/29 19:24:06 wieck Exp $
3535
*
3636
**********************************************************************/
3737

@@ -1818,13 +1818,33 @@ pltcl_SPI_prepare(ClientData cdata, Tcl_Interp *interp,
18181818
************************************************************/
18191819
for (i = 0; i < nargs; i++)
18201820
{
1821-
/* XXX should extend this to allow qualified type names */
1822-
typeTup = typenameType(makeTypeName((char *) args[i]));
1821+
char *argcopy;
1822+
List *names = NIL;
1823+
List *lp;
1824+
TypeName *typename;
1825+
1826+
/************************************************************
1827+
* Use SplitIdentifierString() on a copy of the type name,
1828+
* turn the resulting pointer list into a TypeName node
1829+
* and call typenameType() to get the pg_type tuple.
1830+
************************************************************/
1831+
argcopy = pstrdup(args[i]);
1832+
SplitIdentifierString(argcopy, '.', &names);
1833+
typename = makeNode(TypeName);
1834+
foreach (lp, names)
1835+
typename->names = lappend(typename->names, makeString(lfirst(lp)));
1836+
1837+
typeTup = typenameType(typename);
18231838
qdesc->argtypes[i] = HeapTupleGetOid(typeTup);
18241839
perm_fmgr_info(((Form_pg_type) GETSTRUCT(typeTup))->typinput,
18251840
&(qdesc->arginfuncs[i]));
18261841
qdesc->argtypelems[i] = ((Form_pg_type) GETSTRUCT(typeTup))->typelem;
18271842
ReleaseSysCache(typeTup);
1843+
1844+
freeList(typename->names);
1845+
pfree(typename);
1846+
freeList(names);
1847+
pfree(argcopy);
18281848
}
18291849

18301850
/************************************************************

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy