| From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
|---|---|
| To: | 正华吕 <kainwen(at)gmail(dot)com> |
| Cc: | pgsql-hackers(at)lists(dot)postgresql(dot)org |
| Subject: | Re: Question on ThrowErrorData |
| Date: | 2025-10-20 12:05:28 |
| Message-ID: | 200981.1760961928@sss.pgh.pa.us |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
=?UTF-8?B?5q2j5Y2O5ZCV?= <kainwen(at)gmail(dot)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
| From | Date | Subject | |
|---|---|---|---|
| Next Message | torikoshia | 2025-10-20 12:15:03 | Re: RFC: Logging plan of the running query |
| Previous Message | jian he | 2025-10-20 12:03:06 | Re: misleading error message in ProcessUtilitySlow T_CreateStatsStmt |