1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-30 11:03:19 +03:00

Add a bunch of pseudo-types to replace the behavior formerly associated

with OPAQUE, as per recent pghackers discussion.  I still want to do some
more work on the 'cstring' pseudo-type, but I'm going to commit the bulk
of the changes now before the tree starts shifting under me ...
This commit is contained in:
Tom Lane
2002-08-22 00:01:51 +00:00
parent 606c9b9d4f
commit b663f3443b
126 changed files with 2005 additions and 1205 deletions

View File

@ -31,7 +31,7 @@
* ENHANCEMENTS, OR MODIFICATIONS.
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/pl/tcl/pltcl.c,v 1.59 2002/07/20 05:16:59 momjian Exp $
* $Header: /cvsroot/pgsql/src/pl/tcl/pltcl.c,v 1.60 2002/08/22 00:01:50 tgl Exp $
*
**********************************************************************/
@ -1051,15 +1051,34 @@ compile_pltcl_function(Oid fn_oid, bool is_trigger)
{
free(prodesc->proname);
free(prodesc);
if (!OidIsValid(procStruct->prorettype))
elog(ERROR, "pltcl functions cannot return type \"opaque\""
"\n\texcept when used as triggers");
else
elog(ERROR, "pltcl: cache lookup for return type %u failed",
procStruct->prorettype);
elog(ERROR, "pltcl: cache lookup for return type %u failed",
procStruct->prorettype);
}
typeStruct = (Form_pg_type) GETSTRUCT(typeTup);
/* Disallow pseudotype result, except VOID */
if (typeStruct->typtype == 'p')
{
if (procStruct->prorettype == VOIDOID)
/* okay */;
else if (procStruct->prorettype == TRIGGEROID ||
procStruct->prorettype == OPAQUEOID)
{
free(prodesc->proname);
free(prodesc);
elog(ERROR, "pltcl functions cannot return type %s"
"\n\texcept when used as triggers",
format_type_be(procStruct->prorettype));
}
else
{
free(prodesc->proname);
free(prodesc);
elog(ERROR, "pltcl functions cannot return type %s",
format_type_be(procStruct->prorettype));
}
}
if (typeStruct->typrelid != InvalidOid)
{
free(prodesc->proname);
@ -1090,14 +1109,20 @@ compile_pltcl_function(Oid fn_oid, bool is_trigger)
{
free(prodesc->proname);
free(prodesc);
if (!OidIsValid(procStruct->proargtypes[i]))
elog(ERROR, "pltcl functions cannot take type \"opaque\"");
else
elog(ERROR, "pltcl: cache lookup for argument type %u failed",
procStruct->proargtypes[i]);
elog(ERROR, "pltcl: cache lookup for argument type %u failed",
procStruct->proargtypes[i]);
}
typeStruct = (Form_pg_type) GETSTRUCT(typeTup);
/* Disallow pseudotype argument */
if (typeStruct->typtype == 'p')
{
free(prodesc->proname);
free(prodesc);
elog(ERROR, "pltcl functions cannot take type %s",
format_type_be(procStruct->proargtypes[i]));
}
if (typeStruct->typrelid != InvalidOid)
{
prodesc->arg_is_rel[i] = 1;