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 refactor this, maybe like this:

I can't get excited about it, and I definitely do not like your
suggestion of embedding particular assumptions about the lookup keys
into the API.  What you've got here is a worse error message and a
recipe for proliferation of ad-hoc wrappers around SearchSysCache,
in return for saving a couple of lines per call site.

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.

                        regards, tom lane

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to