On Saturday 07 April 2007 04:08:34 Tom Lane wrote:
> Tzahi Fadida <[EMAIL PROTECTED]> writes:
> > This is an excerpt from my code:
> > newtset->tids = (bytea *) fastgetattr(tupleTSet, LABELS_ALIGNED,
> > fctx->tupleSetDesc, &isnull);
> >
> > It seems that for an empty bytea (only the size of the header), i get
> > that VARSIZE(newtset->tids)==534765440
> > instead of VARHDRSZ.
>
> That code has always been broken, you just failed to exercise the

It always worked before the patch so it was hard to know that. 
You see, i knew from the start that this attribute would never reach certain 
sizes so i never thought it would be toasted.

> problem before.  There needs to be a detoasting call there, not
> merely a cast.  DatumGetByteaP() would probably be appropriate.

Thanks. One more question though, what is the CATALOG_VERSION_NO
of the varlena patch? 

The second problem i have (it is a bit long but simple so please bear with 
me):
You see, before there were slots (at least stable working slots)
tuples (slot_getattr, etc...), i needed this functionality.
So, i created the following function (which broke because of the varlena patch 
on the att_align function):
bool
heap_deformtuple_iterative(HeapTuple tuple,
                                                   TupleDesc tupleDesc,
                                                   Datum *values,
                                                   char *nulls, 
                               deformTupleIterativeState * ds,
                                                   int tillAttNum, bool         
                                finishAll)

Where tuple is tuple,
tupleDesc is of course TupleDesc.
values are to store the deformed values (the array is already allocated).
nulls, same.
ds is a pointer to a structure i made to save the state of the 
heap_deformtuple in mid work.
tillAttNum is a number of attributes from the start to deform up to.
finishAll - deform all the remaining attributes.

Now, i want to move to the more standard way to do this. However, i want to 
keep the structure where i have a tuple->t (the tuple), tuple->v (the values 
array), tuple->n (the nulls array). I keep many tuples in memory like this 
and i can't change this now. I want to keep in memory only the heaptuple 
tuple->t and the deformed arrays tuple->v, tuple->n and possibly another 
needed (such as ds) structure for as long as the tuple is not completely 
deformed.

What do you recommend (aside from me reimplementing the heap_deformtuple 
iterative again hoping it won't break again)?


-- 
Regards,
        Tzahi.
--
Tzahi Fadida
Blog: http://tzahi.blogsite.org | Home Site: http://tzahi.webhop.info
WARNING TO SPAMMERS:  see at 
http://members.lycos.co.uk/my2nis/spamwarning.html

---------------------------(end of broadcast)---------------------------
TIP 6: explain analyze is your friend

Reply via email to