=?UTF-8?B?5q2j5Y2O5ZCV?= <kainwen@gmail.com> writes:
> Inside errfinish, it just does a simple pointer assignment to set
> filename and funcname field (via function set_stack_entry_location()).
Please note the comment on struct ErrorData:
* ErrorData holds the data accumulated during any one ereport() cycle.
* Any non-NULL pointers must point to palloc'd data.
* (The const pointers are an exception; we assume they point at non-freeable
* constant strings.)
...
const char *filename; /* __FILE__ of ereport() call */
...
const char *funcname; /* __func__ of ereport() call */
In practice these are always pointing at compiler-generated
constant strings.
regards, tom lane