Search Postgresql Archives

Tagged types module and varlena changes

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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!



--
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux