888{
890 int rv;
892
893
895
896
897
898#if POSTGIS_PGSQL_VERSION < 100
899 {
900 float4 *floatptr;
901 int nvalues;
902
903 rv = get_attstatsslot(stats_tuple, 0, 0, stats_kind, InvalidOid,
904 NULL, NULL, NULL, &floatptr, &nvalues);
905
906 if ( ! rv ) {
907 POSTGIS_DEBUGF(2, "no slot of kind %d in stats tuple", stats_kind);
908 return NULL;
909 }
910
911
912 nd_stats = palloc(sizeof(float) * nvalues);
913 memcpy(nd_stats, floatptr, sizeof(float) * nvalues);
914
915
916 free_attstatsslot(0, NULL, 0, floatptr, nvalues);
917 }
918#else
919 {
920 AttStatsSlot sslot;
921 rv = get_attstatsslot(&sslot, stats_tuple, stats_kind, InvalidOid,
922 ATTSTATSSLOT_NUMBERS);
923 if ( ! rv ) {
924 POSTGIS_DEBUGF(2, "no slot of kind %d in stats tuple", stats_kind);
925 return NULL;
926 }
927
928
929 nd_stats = palloc(sizeof(float4) * sslot.nnumbers);
930 memcpy(nd_stats, sslot.numbers, sizeof(float4) * sslot.nnumbers);
931
932 free_attstatsslot(&sslot);
933 }
934#endif
935
936 return nd_stats;
937}
#define STATISTIC_KIND_2D
#define STATISTIC_KIND_ND
N-dimensional statistics structure.