diff --git a/src/test/regress/expected/pg13_propagate_statistics.out b/src/test/regress/expected/pg13_propagate_statistics.out index 9f64aad21..ff10c53aa 100644 --- a/src/test/regress/expected/pg13_propagate_statistics.out +++ b/src/test/regress/expected/pg13_propagate_statistics.out @@ -1,3 +1,9 @@ +-- Two alternative test outputs: +-- pg13_propagate_statistics.out for PG16 and before +-- pg13_propagate_statistics_0.out for PG17 +-- related commit +-- Changed stxstattarget in pg_statistic_ext to use nullable representation, removing explicit -1 for default statistics target in PostgreSQL 17. +-- https://github.com/postgres/postgres/commit/012460ee93c304fbc7220e5b55d9d0577fc766ab CREATE SCHEMA "statistics'TestTarget"; SET search_path TO "statistics'TestTarget"; SET citus.next_shard_id TO 980000; diff --git a/src/test/regress/expected/pg13_propagate_statistics_0.out b/src/test/regress/expected/pg13_propagate_statistics_0.out new file mode 100644 index 000000000..e0e3250ed --- /dev/null +++ b/src/test/regress/expected/pg13_propagate_statistics_0.out @@ -0,0 +1,123 @@ +-- Two alternative test outputs: +-- pg13_propagate_statistics.out for PG16 and before +-- pg13_propagate_statistics_0.out for PG17 +-- related commit +-- Changed stxstattarget in pg_statistic_ext to use nullable representation, removing explicit -1 for default statistics target in PostgreSQL 17. +-- https://github.com/postgres/postgres/commit/012460ee93c304fbc7220e5b55d9d0577fc766ab +CREATE SCHEMA "statistics'TestTarget"; +SET search_path TO "statistics'TestTarget"; +SET citus.next_shard_id TO 980000; +SET client_min_messages TO WARNING; +SET citus.shard_count TO 32; +SET citus.shard_replication_factor TO 1; +CREATE TABLE t1 (a int, b int); +CREATE STATISTICS s1 ON a,b FROM t1; +CREATE STATISTICS s2 ON a,b FROM t1; +CREATE STATISTICS s3 ON a,b FROM t1; +CREATE STATISTICS s4 ON a,b FROM t1; +-- test altering stats target +-- test alter target before distribution +ALTER STATISTICS s1 SET STATISTICS 3; +-- since max value for target is 10000, this will automatically be lowered +ALTER STATISTICS s2 SET STATISTICS 999999; +WARNING: lowering statistics target to 10000 +SELECT create_distributed_table('t1', 'b'); + create_distributed_table +--------------------------------------------------------------------- + +(1 row) + +-- test alter target before distribution +ALTER STATISTICS s3 SET STATISTICS 46; +\c - - - :worker_1_port +SELECT stxstattarget, stxrelid::regclass +FROM pg_statistic_ext +WHERE stxnamespace IN ( + SELECT oid + FROM pg_namespace + WHERE nspname IN ('statistics''TestTarget') +) +AND stxname SIMILAR TO '%\_\d+' +ORDER BY stxstattarget, stxrelid::regclass ASC; + stxstattarget | stxrelid +--------------------------------------------------------------------- + 3 | "statistics'TestTarget".t1_980000 + 3 | "statistics'TestTarget".t1_980002 + 3 | "statistics'TestTarget".t1_980004 + 3 | "statistics'TestTarget".t1_980006 + 3 | "statistics'TestTarget".t1_980008 + 3 | "statistics'TestTarget".t1_980010 + 3 | "statistics'TestTarget".t1_980012 + 3 | "statistics'TestTarget".t1_980014 + 3 | "statistics'TestTarget".t1_980016 + 3 | "statistics'TestTarget".t1_980018 + 3 | "statistics'TestTarget".t1_980020 + 3 | "statistics'TestTarget".t1_980022 + 3 | "statistics'TestTarget".t1_980024 + 3 | "statistics'TestTarget".t1_980026 + 3 | "statistics'TestTarget".t1_980028 + 3 | "statistics'TestTarget".t1_980030 + 46 | "statistics'TestTarget".t1_980000 + 46 | "statistics'TestTarget".t1_980002 + 46 | "statistics'TestTarget".t1_980004 + 46 | "statistics'TestTarget".t1_980006 + 46 | "statistics'TestTarget".t1_980008 + 46 | "statistics'TestTarget".t1_980010 + 46 | "statistics'TestTarget".t1_980012 + 46 | "statistics'TestTarget".t1_980014 + 46 | "statistics'TestTarget".t1_980016 + 46 | "statistics'TestTarget".t1_980018 + 46 | "statistics'TestTarget".t1_980020 + 46 | "statistics'TestTarget".t1_980022 + 46 | "statistics'TestTarget".t1_980024 + 46 | "statistics'TestTarget".t1_980026 + 46 | "statistics'TestTarget".t1_980028 + 46 | "statistics'TestTarget".t1_980030 + 10000 | "statistics'TestTarget".t1_980000 + 10000 | "statistics'TestTarget".t1_980002 + 10000 | "statistics'TestTarget".t1_980004 + 10000 | "statistics'TestTarget".t1_980006 + 10000 | "statistics'TestTarget".t1_980008 + 10000 | "statistics'TestTarget".t1_980010 + 10000 | "statistics'TestTarget".t1_980012 + 10000 | "statistics'TestTarget".t1_980014 + 10000 | "statistics'TestTarget".t1_980016 + 10000 | "statistics'TestTarget".t1_980018 + 10000 | "statistics'TestTarget".t1_980020 + 10000 | "statistics'TestTarget".t1_980022 + 10000 | "statistics'TestTarget".t1_980024 + 10000 | "statistics'TestTarget".t1_980026 + 10000 | "statistics'TestTarget".t1_980028 + 10000 | "statistics'TestTarget".t1_980030 + | "statistics'TestTarget".t1_980000 + | "statistics'TestTarget".t1_980002 + | "statistics'TestTarget".t1_980004 + | "statistics'TestTarget".t1_980006 + | "statistics'TestTarget".t1_980008 + | "statistics'TestTarget".t1_980010 + | "statistics'TestTarget".t1_980012 + | "statistics'TestTarget".t1_980014 + | "statistics'TestTarget".t1_980016 + | "statistics'TestTarget".t1_980018 + | "statistics'TestTarget".t1_980020 + | "statistics'TestTarget".t1_980022 + | "statistics'TestTarget".t1_980024 + | "statistics'TestTarget".t1_980026 + | "statistics'TestTarget".t1_980028 + | "statistics'TestTarget".t1_980030 +(64 rows) + +\c - - - :master_port +-- the first one should log a notice that says statistics object does not exist +ALTER STATISTICS IF EXISTS stats_that_doesnt_exists SET STATISTICS 0; +NOTICE: statistics object "stats_that_doesnt_exists" does not exist, skipping +-- these three should error out as ALTER STATISTICS syntax doesn't support these with IF EXISTS clause +-- if output of any of these three changes, we should support them and update the test output here +ALTER STATISTICS IF EXISTS stats_that_doesnt_exists RENAME TO this_should_error_out; +ERROR: syntax error at or near "RENAME" +ALTER STATISTICS IF EXISTS stats_that_doesnt_exists OWNER TO CURRENT_USER; +ERROR: syntax error at or near "OWNER" +ALTER STATISTICS IF EXISTS stats_that_doesnt_exists SET SCHEMA "statistics'Test"; +ERROR: syntax error at or near "SCHEMA" +SET client_min_messages TO WARNING; +DROP SCHEMA "statistics'TestTarget" CASCADE; diff --git a/src/test/regress/sql/pg13_propagate_statistics.sql b/src/test/regress/sql/pg13_propagate_statistics.sql index 5b19f793a..0030c8647 100644 --- a/src/test/regress/sql/pg13_propagate_statistics.sql +++ b/src/test/regress/sql/pg13_propagate_statistics.sql @@ -1,3 +1,9 @@ +-- Two alternative test outputs: +-- pg13_propagate_statistics.out for PG16 and before +-- pg13_propagate_statistics_0.out for PG17 +-- related commit +-- Changed stxstattarget in pg_statistic_ext to use nullable representation, removing explicit -1 for default statistics target in PostgreSQL 17. +-- https://github.com/postgres/postgres/commit/012460ee93c304fbc7220e5b55d9d0577fc766ab CREATE SCHEMA "statistics'TestTarget"; SET search_path TO "statistics'TestTarget"; SET citus.next_shard_id TO 980000;