1
0
mirror of https://github.com/postgres/postgres.git synced 2025-06-30 21:42:05 +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

@ -33,7 +33,7 @@
* ENHANCEMENTS, OR MODIFICATIONS.
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/pl/plperl/plperl.c,v 1.31 2002/06/15 19:54:24 momjian Exp $
* $Header: /cvsroot/pgsql/src/pl/plperl/plperl.c,v 1.32 2002/08/22 00:01:49 tgl Exp $
*
**********************************************************************/
@ -619,15 +619,34 @@ compile_plperl_function(Oid fn_oid, bool is_trigger)
{
free(prodesc->proname);
free(prodesc);
if (!OidIsValid(procStruct->prorettype))
elog(ERROR, "plperl functions cannot return type \"opaque\""
"\n\texcept when used as triggers");
else
elog(ERROR, "plperl: cache lookup for return type %u failed",
procStruct->prorettype);
elog(ERROR, "plperl: 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, "plperl functions cannot return type %s"
"\n\texcept when used as triggers",
format_type_be(procStruct->prorettype));
}
else
{
free(prodesc->proname);
free(prodesc);
elog(ERROR, "plperl functions cannot return type %s",
format_type_be(procStruct->prorettype));
}
}
if (typeStruct->typrelid != InvalidOid)
{
free(prodesc->proname);
@ -657,14 +676,20 @@ compile_plperl_function(Oid fn_oid, bool is_trigger)
{
free(prodesc->proname);
free(prodesc);
if (!OidIsValid(procStruct->proargtypes[i]))
elog(ERROR, "plperl functions cannot take type \"opaque\"");
else
elog(ERROR, "plperl: cache lookup for argument type %u failed",
procStruct->proargtypes[i]);
elog(ERROR, "plperl: 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, "plperl functions cannot take type %s",
format_type_be(procStruct->proargtypes[i]));
}
if (typeStruct->typrelid != InvalidOid)
prodesc->arg_is_rel[i] = 1;
else