/* * PyPgTupleDesc_IsCurrent - determine if all the column types are current */ bool PyPgTupleDesc_IsCurrent(PyObj tdo) { PyObj types = PyPgTupleDesc_GetTypesTuple(tdo); Py_ssize_t i; for (i = 0; i < PyTuple_GET_SIZE(types); ++i) { PyObj t; t = PyTuple_GET_ITEM(types, i); if (t == Py_None) continue; if (!PyPgType_IsCurrent(t)) return(false); } return(true); }
/* * PyPgFunction_IsCurrent - determine if the current pg_proc entry is newer than 'func' */ bool PyPgFunction_IsCurrent(PyObj func) { HeapTuple ht; ItemPointerData fn_tid; TransactionId fn_xmin, last_fn_xmin; last_fn_xmin = PyPgFunction_GetXMin(func); if (last_fn_xmin == InvalidTransactionId) { /* pseudo-function */ return(true); } ht = SearchSysCache(PROCOID, PyPgFunction_GetOid(func), 0, 0, 0); if (!HeapTupleIsValid(ht)) return(false); fn_xmin = HeapTupleHeaderGetXmin(ht->t_data); fn_tid = ht->t_self; ReleaseSysCache(ht); if (last_fn_xmin != fn_xmin || !ItemPointerEquals(PyPgFunction_GetItemPointer(func), &fn_tid)) { return(false); } if (!PyPgTupleDesc_IsCurrent(PyPgFunction_GetInput(func))) { return(false); } if (!PyPgType_IsCurrent(PyPgFunction_GetOutput(func))) return(false); return(true); }