|
29 | 29 | * MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
|
30 | 30 | *
|
31 | 31 | * IDENTIFICATION
|
32 |
| - *$PostgreSQL: pgsql/src/pl/plpython/plpython.c,v 1.56 2004/09/13 20:09:30 tgl Exp $ |
| 32 | + *$PostgreSQL: pgsql/src/pl/plpython/plpython.c,v 1.57 2004/09/19 23:38:21 tgl Exp $ |
33 | 33 | *
|
34 | 34 | *********************************************************************
|
35 | 35 | */
|
@@ -976,7 +976,6 @@ PLy_procedure_create(FunctionCallInfo fcinfo, Oid tgreloid,
|
976 | 976 | HeapTupleprocTup,char*key)
|
977 | 977 | {
|
978 | 978 | charprocName[NAMEDATALEN+256];
|
979 |
| - |
980 | 979 | Form_pg_procprocStruct;
|
981 | 980 | PLyProcedure*volatileproc;
|
982 | 981 | char*volatileprocSource=NULL;
|
@@ -1035,14 +1034,28 @@ PLy_procedure_create(FunctionCallInfo fcinfo, Oid tgreloid,
|
1035 | 1034 | if (!HeapTupleIsValid(rvTypeTup))
|
1036 | 1035 | elog(ERROR,"cache lookup failed for type %u",
|
1037 | 1036 | procStruct->prorettype);
|
1038 |
| - |
1039 | 1037 | rvTypeStruct= (Form_pg_type)GETSTRUCT(rvTypeTup);
|
1040 |
| -if (rvTypeStruct->typtype!='c') |
1041 |
| -PLy_output_datum_func(&proc->result,rvTypeTup); |
1042 |
| -else |
| 1038 | + |
| 1039 | +/* Disallow pseudotype result */ |
| 1040 | +if (rvTypeStruct->typtype=='p') |
| 1041 | +{ |
| 1042 | +if (procStruct->prorettype==TRIGGEROID) |
| 1043 | +ereport(ERROR, |
| 1044 | +(errcode(ERRCODE_FEATURE_NOT_SUPPORTED), |
| 1045 | +errmsg("trigger functions may only be called as triggers"))); |
| 1046 | +else |
| 1047 | +ereport(ERROR, |
| 1048 | +(errcode(ERRCODE_FEATURE_NOT_SUPPORTED), |
| 1049 | +errmsg("plpython functions cannot return type %s", |
| 1050 | +format_type_be(procStruct->prorettype)))); |
| 1051 | +} |
| 1052 | + |
| 1053 | +if (rvTypeStruct->typtype=='c') |
1043 | 1054 | ereport(ERROR,
|
1044 | 1055 | (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
|
1045 |
| -errmsg("tuple return types are not supported yet"))); |
| 1056 | +errmsg("plpython functions cannot return tuples yet"))); |
| 1057 | +else |
| 1058 | +PLy_output_datum_func(&proc->result,rvTypeTup); |
1046 | 1059 |
|
1047 | 1060 | ReleaseSysCache(rvTypeTup);
|
1048 | 1061 | }
|
@@ -1076,6 +1089,13 @@ PLy_procedure_create(FunctionCallInfo fcinfo, Oid tgreloid,
|
1076 | 1089 | procStruct->proargtypes[i]);
|
1077 | 1090 | argTypeStruct= (Form_pg_type)GETSTRUCT(argTypeTup);
|
1078 | 1091 |
|
| 1092 | +/* Disallow pseudotype argument */ |
| 1093 | +if (argTypeStruct->typtype=='p') |
| 1094 | +ereport(ERROR, |
| 1095 | +(errcode(ERRCODE_FEATURE_NOT_SUPPORTED), |
| 1096 | +errmsg("plpython functions cannot take type %s", |
| 1097 | +format_type_be(procStruct->proargtypes[i])))); |
| 1098 | + |
1079 | 1099 | if (argTypeStruct->typtype!='c')
|
1080 | 1100 | PLy_input_datum_func(&(proc->args[i]),
|
1081 | 1101 | procStruct->proargtypes[i],
|
|