Bugfix for bpchar

From: jwieck(at)debis(dot)com (Jan Wieck)
To: pgsql-patches(at)postgreSQL(dot)org (PostgreSQL PATCHES)
Cc: pgsql-hackers(at)postgreSQL(dot)org (PostgreSQL HACKERS)
Subject: Bugfix for bpchar
Date: 1998-02-05 14:32:19
Message-ID: m0y0SLk-000BFRC@orion.SAPserv.Hamburg.dsh.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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(at)debis(dot)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;

Browse pgsql-hackers by date

  From Date Subject
Next Message sferac 1998-02-05 14:34:52 Re: [QUESTIONS] is Postgres an SQL-based database?
Previous Message pghackers 1998-02-05 14:15:08