Re: [HACKERS] Plan for compressed varlena headers

2007-02-15 Thread Gregory Stark
Tom Lane [EMAIL PROTECTED] writes: Gregory Stark [EMAIL PROTECTED] writes: 1) Replace the VARATT_SIZEP macro with SET_VARLENA_LEN. If we're going to do this then it's time to play the name game; Least...fun...game...evar... A first-cut proposal: VARHDRSZsame as

Re: [HACKERS] Plan for compressed varlena headers

2007-02-15 Thread Tom Lane
Gregory Stark [EMAIL PROTECTED] writes: There's also VARATT_CDATA which I suppose I should rename to VARCDATA. I may not even need it once I hit tuptoaster.c since that file works directly with the structure members anyways. I supposed we also rename VARATT_IS_{COMPRESSED,EXTERNAL,EXTENDED} ?

Re: [HACKERS] Plan for compressed varlena headers

2007-02-15 Thread Gregory Stark
Tom Lane [EMAIL PROTECTED] writes: #define VARDATA_4B(PTR) ((PTR)-va_4byte.va_data) #define VARDATA_2B(PTR) ((PTR)-va_2byte.va_data) #define VARDATA_1B(PTR) ((PTR)-va_1byte.va_data) I thought we had abandoned the 2-byte-header variant? Hm, I don't

Re: [HACKERS] Plan for compressed varlena headers

2007-02-15 Thread mark
On Thu, Feb 15, 2007 at 10:42:49AM -0500, Tom Lane wrote: #define VARDATA_4B(PTR) ((PTR)-va_4byte.va_data) #define VARDATA_2B(PTR) ((PTR)-va_2byte.va_data) #define VARDATA_1B(PTR) ((PTR)-va_1byte.va_data) I thought we had abandoned the 2-byte-header

[HACKERS] Plan for compressed varlena headers

2007-02-14 Thread Gregory Stark
So to implement the agreed upon plan I see the following items. 1) Replace the VARATT_SIZEP macro with SET_VARLENA_LEN. I intend to keep this patch separate as it will bitrot quickly and would be best if it could be applied as soon as possible even before the main patch is committed. I

Re: [HACKERS] Plan for compressed varlena headers

2007-02-14 Thread Tom Lane
Gregory Stark [EMAIL PROTECTED] writes: 1) Replace the VARATT_SIZEP macro with SET_VARLENA_LEN. If we're going to do this then it's time to play the name game; that is, pick names we actually like and that work well together. The original TOAST patch made things a bit messy in this area. We

Re: [HACKERS] Plan for compressed varlena headers

2007-02-14 Thread Bruce Momjian
Gregory Stark wrote: 2) Replace VARATT* macros to store and retrieve the toast bits in a manner that will work for variable length headers. This either means storing the bits at the least-significant position or using network byte order. If we want to allow storing 1 headers

Re: [HACKERS] Plan for compressed varlena headers

2007-02-14 Thread Tom Lane
Bruce Momjian [EMAIL PROTECTED] writes: Gregory Stark wrote: If we want to allow storing 1 headers unaligned which I think would be good then I still think we have to read them using bytewise lookups -- ie by casting to (char*). That means network byte order or using the low order bits is

Re: [HACKERS] Plan for compressed varlena headers

2007-02-14 Thread Gregory Stark
Tom Lane [EMAIL PROTECTED] writes: Plus you can't do it without multiple evaluation of the macro argument, which is something I'd really prefer we not introduce into such a widely-used macro. I don't see any way to do VARSIZE without multiply evaluating its argument. It's got to mask out the

Re: [HACKERS] Plan for compressed varlena headers

2007-02-14 Thread Tom Lane
Gregory Stark [EMAIL PROTECTED] writes: Tom Lane [EMAIL PROTECTED] writes: Plus you can't do it without multiple evaluation of the macro argument, I don't see any way to do VARSIZE without multiply evaluating its argument. Some variant of #define VARSIZE(x) (ntohl((x)-vl_len)