diff options
| author | Alvaro Herrera | 2017-04-17 21:34:29 +0000 |
|---|---|---|
| committer | Alvaro Herrera | 2017-04-17 21:34:29 +0000 |
| commit | ee6922112e9b3c02b995bd1d838c9a261f060133 (patch) | |
| tree | 2d8678c97967dbdccdfa692a4b75fdd5f21cbe06 /src/test | |
| parent | 8c5cdb7f4f6e1d6a6104cb58ce4f23453891651b (diff) | |
Rename columns in new pg_statistic_ext catalog
The new catalog reused a column prefix "sta" from pg_statistic, but this
is undesirable, so change the catalog to use prefix "stx" instead.
Also, rename the column that lists enabled statistic kinds as "stxkind"
rather than "enabled".
Discussion: https://postgr.es/m/CAKJS1f_2t5jhSN7huYRFH3w3rrHfG2QU7hiUHsu-Vdjd1rYT3w@mail.gmail.com
Diffstat (limited to 'src/test')
| -rw-r--r-- | src/test/regress/expected/alter_generic.out | 8 | ||||
| -rw-r--r-- | src/test/regress/expected/stats_ext.out | 30 | ||||
| -rw-r--r-- | src/test/regress/sql/alter_generic.sql | 6 | ||||
| -rw-r--r-- | src/test/regress/sql/stats_ext.sql | 14 |
4 files changed, 29 insertions, 29 deletions
diff --git a/src/test/regress/expected/alter_generic.out b/src/test/regress/expected/alter_generic.out index ce581bb93d5..a81a4edfb2b 100644 --- a/src/test/regress/expected/alter_generic.out +++ b/src/test/regress/expected/alter_generic.out @@ -525,12 +525,12 @@ ERROR: must be owner of statistics alt_stat3 ALTER STATISTICS alt_stat2 SET SCHEMA alt_nsp2; -- failed (name conflict) ERROR: statistics "alt_stat2" already exists in schema "alt_nsp2" RESET SESSION AUTHORIZATION; -SELECT nspname, staname, rolname +SELECT nspname, stxname, rolname FROM pg_statistic_ext s, pg_namespace n, pg_authid a - WHERE s.stanamespace = n.oid AND s.staowner = a.oid + WHERE s.stxnamespace = n.oid AND s.stxowner = a.oid AND n.nspname in ('alt_nsp1', 'alt_nsp2') - ORDER BY nspname, staname; - nspname | staname | rolname + ORDER BY nspname, stxname; + nspname | stxname | rolname ----------+-----------+--------------------- alt_nsp1 | alt_stat2 | regress_alter_user2 alt_nsp1 | alt_stat3 | regress_alter_user1 diff --git a/src/test/regress/expected/stats_ext.out b/src/test/regress/expected/stats_ext.out index 658d2857695..0d6f65e604b 100644 --- a/src/test/regress/expected/stats_ext.out +++ b/src/test/regress/expected/stats_ext.out @@ -12,7 +12,7 @@ DROP STATISTICS ab1_a_b_stats; CREATE SCHEMA regress_schema_2; CREATE STATISTICS regress_schema_2.ab1_a_b_stats ON (a, b) FROM ab1; -- Let's also verify the pg_get_statisticsextdef output looks sane. -SELECT pg_get_statisticsextdef(oid) FROM pg_statistic_ext WHERE staname = 'ab1_a_b_stats'; +SELECT pg_get_statisticsextdef(oid) FROM pg_statistic_ext WHERE stxname = 'ab1_a_b_stats'; pg_get_statisticsextdef --------------------------------------------------------------------- CREATE STATISTICS regress_schema_2.ab1_a_b_stats ON (a, b) FROM ab1 @@ -173,11 +173,11 @@ ERROR: duplicate column name in statistics definition -- correct command CREATE STATISTICS s10 ON (a, b, c) FROM ndistinct; ANALYZE ndistinct; -SELECT staenabled, standistinct - FROM pg_statistic_ext WHERE starelid = 'ndistinct'::regclass; - staenabled | standistinct -------------+------------------------------------------------------------------------------------------------ - {d,f} | [{(b 3 4), 301.000000}, {(b 3 6), 301.000000}, {(b 4 6), 301.000000}, {(b 3 4 6), 301.000000}] +SELECT stxkind, stxndistinct + FROM pg_statistic_ext WHERE stxrelid = 'ndistinct'::regclass; + stxkind | stxndistinct +---------+------------------------------------------------------------------------------------------------ + {d,f} | [{(b 3 4), 301.000000}, {(b 3 6), 301.000000}, {(b 4 6), 301.000000}, {(b 3 4 6), 301.000000}] (1 row) -- Hash Aggregate, thanks to estimates improved by the statistic @@ -239,11 +239,11 @@ INSERT INTO ndistinct (a, b, c, filler1) cash_words(mod(i,33)::int::money) FROM generate_series(1,10000) s(i); ANALYZE ndistinct; -SELECT staenabled, standistinct - FROM pg_statistic_ext WHERE starelid = 'ndistinct'::regclass; - staenabled | standistinct -------------+---------------------------------------------------------------------------------------------------- - {d,f} | [{(b 3 4), 2550.000000}, {(b 3 6), 800.000000}, {(b 4 6), 1632.000000}, {(b 3 4 6), 10000.000000}] +SELECT stxkind, stxndistinct + FROM pg_statistic_ext WHERE stxrelid = 'ndistinct'::regclass; + stxkind | stxndistinct +---------+---------------------------------------------------------------------------------------------------- + {d,f} | [{(b 3 4), 2550.000000}, {(b 3 6), 800.000000}, {(b 4 6), 1632.000000}, {(b 3 4 6), 10000.000000}] (1 row) -- plans using Group Aggregate, thanks to using correct esimates @@ -299,10 +299,10 @@ EXPLAIN (COSTS off) (3 rows) DROP STATISTICS s10; -SELECT staenabled, standistinct - FROM pg_statistic_ext WHERE starelid = 'ndistinct'::regclass; - staenabled | standistinct -------------+-------------- +SELECT stxkind, stxndistinct + FROM pg_statistic_ext WHERE stxrelid = 'ndistinct'::regclass; + stxkind | stxndistinct +---------+-------------- (0 rows) -- dropping the statistics switches the plans to Hash Aggregate, diff --git a/src/test/regress/sql/alter_generic.sql b/src/test/regress/sql/alter_generic.sql index f6fa8d8bfdb..88e8d7eb86b 100644 --- a/src/test/regress/sql/alter_generic.sql +++ b/src/test/regress/sql/alter_generic.sql @@ -459,11 +459,11 @@ ALTER STATISTICS alt_stat3 SET SCHEMA alt_nsp2; -- failed (not owner) ALTER STATISTICS alt_stat2 SET SCHEMA alt_nsp2; -- failed (name conflict) RESET SESSION AUTHORIZATION; -SELECT nspname, staname, rolname +SELECT nspname, stxname, rolname FROM pg_statistic_ext s, pg_namespace n, pg_authid a - WHERE s.stanamespace = n.oid AND s.staowner = a.oid + WHERE s.stxnamespace = n.oid AND s.stxowner = a.oid AND n.nspname in ('alt_nsp1', 'alt_nsp2') - ORDER BY nspname, staname; + ORDER BY nspname, stxname; -- -- Text Search Dictionary diff --git a/src/test/regress/sql/stats_ext.sql b/src/test/regress/sql/stats_ext.sql index 3c7e0684d3e..72c7659c4b1 100644 --- a/src/test/regress/sql/stats_ext.sql +++ b/src/test/regress/sql/stats_ext.sql @@ -16,7 +16,7 @@ CREATE SCHEMA regress_schema_2; CREATE STATISTICS regress_schema_2.ab1_a_b_stats ON (a, b) FROM ab1; -- Let's also verify the pg_get_statisticsextdef output looks sane. -SELECT pg_get_statisticsextdef(oid) FROM pg_statistic_ext WHERE staname = 'ab1_a_b_stats'; +SELECT pg_get_statisticsextdef(oid) FROM pg_statistic_ext WHERE stxname = 'ab1_a_b_stats'; DROP STATISTICS regress_schema_2.ab1_a_b_stats; @@ -130,8 +130,8 @@ CREATE STATISTICS s10 ON (a, b, c) FROM ndistinct; ANALYZE ndistinct; -SELECT staenabled, standistinct - FROM pg_statistic_ext WHERE starelid = 'ndistinct'::regclass; +SELECT stxkind, stxndistinct + FROM pg_statistic_ext WHERE stxrelid = 'ndistinct'::regclass; -- Hash Aggregate, thanks to estimates improved by the statistic EXPLAIN (COSTS off) @@ -161,8 +161,8 @@ INSERT INTO ndistinct (a, b, c, filler1) ANALYZE ndistinct; -SELECT staenabled, standistinct - FROM pg_statistic_ext WHERE starelid = 'ndistinct'::regclass; +SELECT stxkind, stxndistinct + FROM pg_statistic_ext WHERE stxrelid = 'ndistinct'::regclass; -- plans using Group Aggregate, thanks to using correct esimates EXPLAIN (COSTS off) @@ -182,8 +182,8 @@ EXPLAIN (COSTS off) DROP STATISTICS s10; -SELECT staenabled, standistinct - FROM pg_statistic_ext WHERE starelid = 'ndistinct'::regclass; +SELECT stxkind, stxndistinct + FROM pg_statistic_ext WHERE stxrelid = 'ndistinct'::regclass; -- dropping the statistics switches the plans to Hash Aggregate, -- due to under-estimates |
