Hello,
I can't to find reason of my problem. I have a varlena type. This type
works well with plain storage, but this raise some random exception
with extended storage. It finish on Assert((data - start) ==
data_size)[heaptuple.c]; I checked - when I return varlena from in
function, then it has correct size, but in this function VARSIZE
returns different value.
some logNOTICE: KOKES SIZE 36242, pointer: 149948300 -- varlena checkNOTICE: heap_fill_tuple [size: 36250, bits -1,
tupleesc:150141444, attrs: 3NOTICE: iteration 0NOTICE: >>> attbyval 1, attlen 4NOTICE: [data: 150208808d, data
length:4]NOTICE: iteration 1NOTICE: >>> attbyval 1, attlen 4NOTICE: [data: 150208812d, data length: 4]NOTICE:
iteration2NOTICE: >>> attbyval 0, attlen -1NOTICE: FULL VARLENA 149948300 <36242> -- correct size in heap_fill_tuple
butNOTICE: KOKES SIZE 55966, pointer: 150029636, -- varlena sizeNOTICE: heap_fill_tuple [size: 55974, bits -1,
tupleesc:149930464, attrs: 3NOTICE: iteration 0NOTICE: >>> attbyval 1, attlen 4NOTICE: [data: 150029680d, data
length:4]NOTICE: iteration 1NOTICE: >>> attbyval 1, attlen 4NOTICE: [data: 150029684d, data length: 4]NOTICE:
iteration2NOTICE: >>> attbyval 0, attlen -1NOTICE: FULL VARLENA 150029636 <13999> -- wrong size, why?NOTICE: 14007
[55974]
psql83:/home/pavel/src/postgresql-8.3.7/contrib/kokes/objerr1.sql:4:
server closed the connection unexpectedlyThis probably means the server terminated abnormallybefore or while processing
therequest.
any idea, why size of varlena is broken?
thank you
Pavel Stehule
p.s. I use macros SET_VARSIZE and VARSIZE
define DatumGetKokesData(x)<-->((KokesData*)DatumGetPointer(x))
#define PG_GETARG_KokesData(x)<>DatumGetKokesData(
PG_DETOAST_DATUM(PG_GETARG_DATUM(x)) )
#define PG_RETURN_KokesData(x)<>PG_RETURN_POINTER(x)