Tagged types module and varlena changes
От | Alban Hertroys |
---|---|
Тема | Tagged types module and varlena changes |
Дата | |
Msg-id | D17BE14A-6EF9-4FCA-A4F5-69831A01B581@solfertje.student.utwente.nl обсуждение исходный текст |
Ответы |
Re: Tagged types module and varlena changes
|
Список | pgsql-general |
Hello all, I'm trying to get Marcel's tagged types to work, but I ran into some problems due to changes to the varlena type since he wrote that code. I tried contacting him personally earlier, but he's having some hardware issues apparently and can't help me; hence me asking here ;) The problem is that the tagged types module uses this bit of code: > struct varlena* tv = (struct varlena*)tt_palloc( VARSIZE( datum ) ); > > tv->vl_len = VARSIZE( datum ) - sizeof(Oid); > memcpy( tv->vl_dat, > &((struct taggedtypev*)DatumGetPointer( datum ))->val, > VARSIZE(datum) - sizeof(Oid) - VARHDRSZ ); > return PointerGetDatum( tv ) ; This doesn't compile anymore as the vl_len member of struct varlena no longer exists and we're supposed to use the SET_VARSIZE macro instead now. I tried that, but then the memcpy bails out due to the size calculation being wrong. I don't know enough about varlena usage to figure out what the correct way of calculating the size for memcpy is, or whether that approach is at all feasable with the current varlena implementation. What should the above read? I'm also slightly worried whether DatumGetPointer might return a null- pointer in some cases. Is that possible? Alban Hertroys -- If you can't see the forest for the trees, cut the trees and you'll see there is no forest. !DSPAM:737,4a95273611861044619247!
В списке pgsql-general по дате отправления: