| 217 | } |
| 218 | |
| 219 | Datum |
| 220 | plpython_validator(PG_FUNCTION_ARGS) |
| 221 | { |
| 222 | Oid funcoid = PG_GETARG_OID(0); |
| 223 | HeapTuple tuple; |
| 224 | Form_pg_proc procStruct; |
| 225 | bool is_trigger; |
| 226 | |
| 227 | if (!CheckFunctionValidatorAccess(fcinfo->flinfo->fn_oid, funcoid)) |
| 228 | PG_RETURN_VOID(); |
| 229 | |
| 230 | if (!check_function_bodies) |
| 231 | PG_RETURN_VOID(); |
| 232 | |
| 233 | /* Do this only after making sure we need to do something */ |
| 234 | PLy_initialize(); |
| 235 | |
| 236 | /* Get the new function's pg_proc entry */ |
| 237 | tuple = SearchSysCache1(PROCOID, ObjectIdGetDatum(funcoid)); |
| 238 | if (!HeapTupleIsValid(tuple)) |
| 239 | elog(ERROR, "cache lookup failed for function %u", funcoid); |
| 240 | procStruct = (Form_pg_proc) GETSTRUCT(tuple); |
| 241 | |
| 242 | is_trigger = PLy_procedure_is_trigger(procStruct); |
| 243 | |
| 244 | ReleaseSysCache(tuple); |
| 245 | |
| 246 | /* We can't validate triggers against any particular table ... */ |
| 247 | PLy_procedure_get(funcoid, InvalidOid, is_trigger); |
| 248 | |
| 249 | PG_RETURN_VOID(); |
| 250 | } |
| 251 | |
| 252 | #if PY_MAJOR_VERSION < 3 |
| 253 | Datum |
no test coverage detected