Joe Conway <[EMAIL PROTECTED]> writes:
> I'll give it a shot, but a crude gameplan/general guidance to get me 
> started would be much appreciated.

AFAIK, the only code you should need to touch is in
        src/include/utils/array.h
        src/backend/utils/adt/arrayfuncs.c
        src/backend/utils/adt/arrayutils.c

Look around for other references to ArrayType, but I don't *think* there
is anything else that processes arrays directly; everything else
should be calling construct_array() or deconstruct_array().

Adding an element-type OID field to the array header (ArrayType struct)
ought to be a pretty straightforward exercise.  We need to debate
whether to store a typmod as well; I'm not sure that the space for it
would be justified.

The other thing that was bothering me was that the code is sloppy about
alignment: although the overall start of the data area is correctly
MAXALIGN'd, the offsets of individual data items in the array aren't
necessarily made to be multiples of the element data type's alignment
spec.  This would probably result in core dumps for datatypes whose size
is not a multiple of their alignment requirement.  (The only standard
one is INTERVAL.  For reasons I've never quite figured out, an array
of INTERVAL doesn't provoke core dumps; seems like it should, at least
on machines where doubles actually require 8-byte alignment.)  There are
a dozen or two places in arrayfuncs.c that understand the alignment
conventions for array elements, and they all need to be changed.  The
att_align macro in src/include/access/tupmacs.h is probably the thing
to be using; look at the code in heaptuple.c to see how we position
field values inside a tuple, and do likewise.

                        regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
    (send "unregister YourEmailAddressHere" to [EMAIL PROTECTED])

Reply via email to