Re: [HACKERS] Getting the length of varlength data using PG_DETOAST_DATUM_SLICE

2006-02-11 Thread Mark Dilger
Jeremy Drake wrote: It looks like pg_column_size gives you the actual size on disk, ie after compression. What looks interesting for you would be byteaoctetlen or the function it wraps, toast_raw_datum_size. See src/backend/access/heap/tuptoaster.c. pg_column_size calls toast_datum_size, while

Re: [HACKERS] Getting the length of varlength data using PG_DETOAST_DATUM_SLICE

2006-02-10 Thread Mark Dilger
Bruce Momjian wrote: Have you looked at the 8.1.X buildin function pg_column_size()? Thanks Bruce for the lead. I didn't know what to grep for; this helps. The header comment for that function says "Return the size of a datum, possibly compressed" I take it the uncompressed length i

Re: [HACKERS] Getting the length of varlength data using

2006-02-10 Thread Jeremy Drake
It looks like pg_column_size gives you the actual size on disk, ie after compression. What looks interesting for you would be byteaoctetlen or the function it wraps, toast_raw_datum_size. See src/backend/access/heap/tuptoaster.c. pg_column_size calls toast_datum_size, while byteaoctetlen/textocte

Re: [HACKERS] Getting the length of varlength data using PG_DETOAST_DATUM_SLICE

2006-02-10 Thread Bruce Momjian
Have you looked at the 8.1.X buildin function pg_column_size()? --- Mark Dilger wrote: > Hello, could anyone tell me, for a user contributed variable length data > type, > how can you access the length of the data without

[HACKERS] Getting the length of varlength data using PG_DETOAST_DATUM_SLICE or similar?

2006-02-10 Thread Mark Dilger
Hello, could anyone tell me, for a user contributed variable length data type, how can you access the length of the data without pulling the entire thing from disk? Is there a function or macro for this? As a first cut, I tried using the PG_DETOAST_DATUM_SLICE macro, but to no avail. grep'in