Andrew - Supernews <[EMAIL PROTECTED]> writes:
> Interpreting PQfmod requires a rather intimate knowledge of the internal
> type implementations.

> For several types, including varchar, the typmod is rather arbitrarily
> the type's length limit plus the size of a varlena header (which appears
> to be 4 bytes on all platforms, even 64-bit ones).

Right --- it's +4 regardless of sizeof(Pointer).  If we had it to do
over we'd surely have eliminated that and defined the typmod as exactly
the externally supplied length number ... but changing it now would
break way too much stuff.

It is conceivable there will someday be a compile-time option to make
the varlena overhead 8 bytes, to support field widths wider than 32 bits
(but don't hold your breath waiting for this).  I think though that we'd
probably find it wise to continue to define typmod as length limit plus
4, to avoid breaking client code that would usually not know what the
server's internal representation is.

                        regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 8: explain analyze is your friend

Reply via email to