On 11/11/24 10:30, Ľuboslav Špilák wrote:
> Hello.
>
> After creating new database cluster (5433) in Postgresql 17 there was no
> problem with calling function
> select * from brin_page_items(
> get_raw_page(
>
>
> On the pg_upgraded cluster I got this backtrace on sigsegv. Is this
> helpful or do I need to include any more information?
>
Could you maybe try on a completely new 17.0 cluster, not one that went
through pg_upgrade? I don't think pg_upgrade should cause anything like
this, but it'd be good to conclusively rule that out by reproducing the
issue on a fresh cluster.
> (gdb) c
> Continuing.
>
> Program received signal SIGSEGV, Segmentation fault.
> 0x00005627752205d5 in heap_compute_data_size
> (tupleDesc=tupleDesc@entry=0x5627a1df38c0,
> values=values@entry=0x7fff4744a450, isnull=isnull@entry=0x7fff4744a448)
> at ./build/../src/backend/access/common/heaptuple.c:234
> 234 ./build/../src/backend/access/common/heaptuple.c: No such file
> or directory.
> (gdb) bt
> #0 0x00005627752205d5 in heap_compute_data_size
> (tupleDesc=tupleDesc@entry=0x5627a1df38c0,
> values=values@entry=0x7fff4744a450, isnull=isnull@entry=0x7fff4744a448)
> at ./build/../src/backend/access/common/heaptuple.c:234
This is ... weird. heap_compute_data_size literally didn't change for
the last 9 years, so it's the same for 12 and 17. Line 234 is this:
Size
heap_compute_data_size(TupleDesc tupleDesc,
const Datum *values,
const bool *isnull)
{
Size data_length = 0;
int i;
int numberOfAttributes = tupleDesc->natts;
for (i = 0; i < numberOfAttributes; i++)
{
Datum val;
Form_pg_attribute atti;
if (isnull[i])
continue;
val = values[i];
atti = TupleDescAttr(tupleDesc, i);
if (ATT_IS_PACKABLE(atti) &&
VARATT_CAN_MAKE_SHORT(DatumGetPointer(val)))
I wonder which of the conditions triggers the segfault. Whether the one
accessing the attribute info (atti), or the one checking the pointer. It
has to be the first, because we're dealing with int8, and that's not a
varlena type, so it's not packable. So my guess would be atti is some
bogus pointer, with garbage.
Could you please print variables "i", "numberOfAttributes" and then also
the contents of tupleDesc and atti?
print i
print numberOfAttributes
print *tupleDesc
print *atti
regards
--
Tomas Vondra