Re: [HACKERS] Refactoring SearchSysCache + HeapTupleIsValid

2008-12-11 Thread Alvaro Herrera
Peter Eisentraut wrote: > About the error message, I find neither version to be very good. People see > these messages and don't know what to do. I agree. People see this: ERROR: cache lookup failure for constraint 123123123 and they think it means the same as this: ERROR: cache lookup fail

Re: [HACKERS] Refactoring SearchSysCache + HeapTupleIsValid

2008-12-11 Thread Peter Eisentraut
On Thursday 11 December 2008 15:28:08 Tom Lane wrote: > Peter Eisentraut <[EMAIL PROTECTED]> writes: > > Our code contains about 200 copies of the following code: > > tuple = SearchSysCache[Copy](FOOOID, ObjectIdGetDatum(fooid), 0, 0, 0); > > if (!HeapTupleIsValid(tuple)) > > elog(ERROR, "cach

Re: [HACKERS] Refactoring SearchSysCache + HeapTupleIsValid

2008-12-11 Thread Alvaro Herrera
Tom Lane wrote: > If we could just move the error into SearchSysCache it might be worth > doing, but I think there are callers that need the flexibility to not > fail. Pass a boolean flag? -- Alvaro Herrerahttp://www.CommandPrompt.com/ PostgreSQL Replication, Con

Re: [HACKERS] Refactoring SearchSysCache + HeapTupleIsValid

2008-12-11 Thread Tom Lane
Peter Eisentraut <[EMAIL PROTECTED]> writes: > Our code contains about 200 copies of the following code: > tuple = SearchSysCache[Copy](FOOOID, ObjectIdGetDatum(fooid), 0, 0, 0); > if (!HeapTupleIsValid(tuple)) > elog(ERROR, "cache lookup failed for foo %u", fooid); > ... > Shouldn't we try to

[HACKERS] Refactoring SearchSysCache + HeapTupleIsValid

2008-12-11 Thread Peter Eisentraut
Our code contains about 200 copies of the following code: tuple = SearchSysCache[Copy](FOOOID, ObjectIdGetDatum(fooid), 0, 0, 0); if (!HeapTupleIsValid(tuple)) elog(ERROR, "cache lookup failed for foo %u", fooid); This only counts elog() calls, not user-facing error messages constructed wit