Re: ERROR: index row size

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Jeremy Drake <pgsql(at)jdrake(dot)com>
Cc: Rodrigo Sakai <rodrigo(dot)sakai(at)poli(dot)usp(dot)br>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: ERROR: index row size
Date: 2007-06-04 03:53:19
Message-ID: 1935.1180929199@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Jeremy Drake <pgsql(at)jdrake(dot)com> writes:
>> char tvi_char[MAXDATEFIELDS];
>>
>> tvi_char = (char *) palloc(strlen(MAXDATEFIELDS));

> What are you doing here? This is completely broken.

Indeed ... *please* tell us your compiler issued a warning about that.
If not an error --- none of the compilers I use will take it at all.
Maybe you need to get a real C compiler.

>> result->tvi = StringToDateADT(tvi_char);
>> result->tvi = StringToDateADT(tvf_char);
>>
>> result = (Periodo *) palloc(sizeof(Periodo));

Well, you oughta allocate result before you store into it, not after,
and I bet you meant to assign to the tvi and tvf fields, not tvi twice.

Bad as these mistakes are, they don't directly explain why a later index
entry creation would fail. What I'm betting is that your CREATE TYPE
command does not correctly describe the datatype size. Based on this
code it should be pass-by-reference, fixed-size-8-bytes, but I'll bet
a nickel your CREATE TYPE says something else --- probably varlena.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Rodrigo Sakai 2007-06-04 03:59:18 Re: ERROR: index row size
Previous Message Tom Lane 2007-06-04 03:29:33 Re: What is happening on buildfarm member baiji?