Thanks Greg, for showing interest. The problem here is I need to store values of different types into bytearray column of relation.
On Fri, Mar 6, 2009 at 4:33 PM, Greg Stark <st...@enterprisedb.com> wrote: > On Fri, Mar 6, 2009 at 10:03 AM, Kedar Potdar <kedar.pot...@gmail.com> > wrote: > > > > The aforementioned code works fine for types like int, data, text and I > can > > read values from the relation correctly. The problem arises for type > > "float8" which is not "by value" type and it has fixed length (8) where I > > can't read the values written to relation correctly. > > > > Am i missing something here? > > Well as you've correctly diagnosed, not all byvalue data types are > variable-length. > > This code all seems unnecessary. The whole point of heap_form_datum > and heap_deform_datum/heap_getattr is that you don't have to worry > about all this. there are also functions like datumCopy() but you > probably don't even need them here, you can just put the datums you > have handy into the values[] array and pass that to heap_form_tuple -- > it'll copy them into the resulting tuple so once you've formed the > tuple you don't have to worry about the lifetime of the original > datums. heap_deform_tuple() and heap_getattr can return pointers into > the original tuple so you do have to be careful to copy them if you > need them to survive the original tuple -- but you might not be > anyways. > > > -- > greg >