Search Postgresql Archives

Re: Tagged types module and varlena changes

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

 



Alban Hertroys <dalroi@xxxxxxxxxxxxxxxxxxxxxxxxxxxx> writes:
> I changed it to:
>> SET_VARSIZE(tv->vl_len_, a);

This is just wrong; use SET_VARSIZE(tv, ...).

>> memcpy( tv->vl_dat, &typev->val, b );

And I wouldn't recommend referencing vl_dat directly either.
Use VARDATA().

In general you're supposed to apply VARSIZE() and VARDATA() and
friends to pointers not Datums.  Although it would usually work
to be sloppy about this, I can't recommend it.  I would extract
the typev pointer first and then apply the VARSIZE macro to it.

> (gdb) print *tv
> $1 = {vl_len_ = "\000\000\000", vl_dat = ""}
> (gdb) print a
> $2 = 0
> (gdb) print b
> $3 = -4
> (gdb) print *typev
> $4 = {len = "\020\000\000", tag = 68899, val = "!\000\000"}

Where did the input come from?  On a little-endian machine that len
value means 4 bytes, so it's wrong right off the bat if it's
supposed to include the tag.

			regards, tom lane

-- 
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