Bugfix for bpchar

Started by Nonamealmost 28 years ago1 messages
#1Noname
jwieck@debis.com

Hi,

after spending 3 hours in gdb I found it :-)

Symptom:
select from a table with attrs (a int, b char(20))
crashed in bpcharout() (palloc of -1 bytes). But a table
with attrs (a int, b varchar(20)) worked.

Bug location:
Function nocachegetattr() in access/common/heaptuple.c
line 557. Really surprising - and really hard to find -
phew.

Until later, Jan

--

#======================================================================#
# It's easier to get forgiveness for being wrong than for being right. #
# Let's break this rule - forgive me. #
#======================================== jwieck@debis.com (Jan Wieck) #

*** heaptuple.c	Thu Feb  5 15:21:50 1998
--- heaptuple.c.old	Thu Feb  5 15:21:39 1998
***************
*** 554,560 ****
  		while (att[j]->attcacheoff > 0)
  			j++;
! 		if (!VARLENA_FIXED_SIZE(att[j - 1]))
  			off = att[j - 1]->attcacheoff + att[j - 1]->attlen;
  		else
  			off = att[j - 1]->attcacheoff + att[j - 1]->atttypmod;
--- 554,560 ----
  		while (att[j]->attcacheoff > 0)
  			j++;

! if (!VARLENA_FIXED_SIZE(att[j]))
off = att[j - 1]->attcacheoff + att[j - 1]->attlen;
else
off = att[j - 1]->attcacheoff + att[j - 1]->atttypmod;