using __func__ to locate and distinguish some error messages - Mailing list pgsql-hackers

From jian he
Subject using __func__ to locate and distinguish some error messages
Date
Msg-id CACJufxHZmDeCSqdU745Vs954kD3ujrYHgon_6yCmdsp6AnwVSA@mail.gmail.com
Whole thread Raw
Responses Re: using __func__ to locate and distinguish some error messages
List pgsql-hackers
hi.

we have 450 appearance of
`cache lookup failed .*`

we have 141 appearance of
`could not open file .*`

so when it actually happens, it cannot quickly locate which function
where the error has happened.
maybe under certain conditions (e.g. certain build type or certain
log_min_messages),
we can also print out the function name by using gcc __func__.

or we can just do like:
if (!HeapTupleIsValid(tuple))
elog(ERROR, "cache lookup failed for relation %u %s",
RelationGetRelid(rel), __func__);

given that these errors are very unlikely to happen, if it happens,
printing out the function name seems not that inversive?



pgsql-hackers by date:

Previous
From: "Ryo Matsumura (Fujitsu)"
Date:
Subject: Re: Bug: PGTYPEStimestamp_from_asc() in ECPG pgtypelib
Next
From: Dilip Kumar
Date:
Subject: Re: use CREATE DATABASE STRATEGY = FILE_COPY in pg_upgrade