VARSIZE_ANY(data), expected_size);
/* Now copy the array of type Oids. */
- memcpy(ptr, mcvlist->types, sizeof(Oid) * ndims);
+ memcpy(mcvlist->types, ptr, sizeof(Oid) * ndims);
ptr += (sizeof(Oid) * ndims);
/* ensure alignment of the pointer (after the header fields) */
50 | 50
(1 row)
+-- test pg_mcv_list_items with a very simple (single item) MCV list
+TRUNCATE mcv_lists;
+INSERT INTO mcv_lists (a, b, c) SELECT 1, 2, 3 FROM generate_series(1,1000) s(i);
+ANALYZE mcv_lists;
+SELECT m.* FROM pg_statistic_ext,
+ pg_mcv_list_items(stxmcv) m WHERE stxname = 'mcv_lists_stats';
+ index | values | nulls | frequency | base_frequency
+-------+-----------+---------+-----------+----------------
+ 0 | {1, 2, 3} | {f,f,f} | 1 | 1
+(1 row)
+
RESET random_page_cost;
-- mcv with arrays
CREATE TABLE mcv_lists_arrays (
SELECT * FROM check_estimated_rows('SELECT * FROM mcv_lists WHERE a IS NULL AND b IS NULL AND c IS NULL');
+-- test pg_mcv_list_items with a very simple (single item) MCV list
+TRUNCATE mcv_lists;
+INSERT INTO mcv_lists (a, b, c) SELECT 1, 2, 3 FROM generate_series(1,1000) s(i);
+ANALYZE mcv_lists;
+
+SELECT m.* FROM pg_statistic_ext,
+ pg_mcv_list_items(stxmcv) m WHERE stxname = 'mcv_lists_stats';
+
RESET random_page_cost;
-- mcv with arrays