Ranier Vilela <ranier.vf@gmail.com> writes:
> Em qui., 27 de jun. de 2024 às 13:18, Tom Lane <tgl@sss.pgh.pa.us> escreveu:
>> In any case, I found that adding some copying logic to CopyErrorData()
>> is enough to solve this problem, since the SPI infrastructure applies
>> that before executing xact cleanup.
> In this case, I think that these fields, in struct definition struct
> ErrorData (src/include/utils/elog.h)
> should be changed too?
> from const char * to char*
No, that would imply casting away const in errstart() etc. We're
still mostly expecting those things to be pointers to constant
strings.
I'm about half tempted to file this as an LLVM bug. When it inlines
a function, it should still reference the same string constants that
the original code did, otherwise it's failing to be a transparent
conversion. But they'll probably cite some standards-ese that claims
this is undefined behavior:
const char * foo(void) { return "foo"; }
void bar(void) { Assert( foo() == foo() ); }
on which I call BS, but it's probably in there somewhere.
regards, tom lane