Avoid unnecessary memory copy in gserialized_datum_get_box2df_p
|Reported by:||hayamiz||Owned by:||pramsey|
In gserialized_datum_get_box2df_p, PG_DETOAST_DATUM_SLICE is always called for obtaining header section of the gserialized datum. PG_DETOAST_DATUM_SLICE always performs memory allocation and copy, but such memory operations are not necessary when the datum is not extended( not external nor compressed ).
This patch removes such extra memory operations. In case of non-external and non-compressed geometry data, PG_DETOAST_DATUM is used instead of _SLICE. For external or compressed (typically large) geometry data, PG_DETOAST_DATUM_SLICE is still used not to copy whole objects.