pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Alvaro Herrera <alvherre@2ndquadrant.com>
To: Simon Riggs <simon@2ndquadrant.com>
Cc: Tomas Vondra <tomas.vondra@2ndquadrant.com>
Cc: PostgreSQL-development <pgsql-hackers@postgresql.org>
Cc: Stephen Frost <sfrost@snowman.net>
Subject: Re: WITH clause in CREATE STATISTICS
Date: Wed, 3 May 2017 14:27:46 -0300
Message-ID: <20170503172746.rwftidszir67sgk7@alvherre.pgsql> (raw)
In-Reply-To: <20170503151801.4u46436mc64r2bfa@alvherre.pgsql>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-hackers>

Alvaro Herrera wrote:

> In the meantime, I noticed that pg_dump support for extstats is not
> covered, which I'll go fix next.

Here I add one, which seems to work for me.

Considering that Stephen missed a terminating semicolon for test with
create_order 96 (the last one prior to my commit) in commit
31a8b77a9244, I propose that we change whatever is concatenating those
strings append a terminating semicolon.  (Surely we don't care about two
tests stanzas writing a single SQL command by omitting the semicolon
terminator.)

I wonder if there's any rationale to the create_order numbers.  Surely
we only care for objects that depend on others.

-- 
Álvaro Herrera                https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
From 1dcb16de656d48c1004d4f4a12475438618a5c72 Mon Sep 17 00:00:00 2001
From: Alvaro Herrera <alvherre@alvh.no-ip.org>
Date: Wed, 3 May 2017 14:18:22 -0300
Subject: [PATCH] Add pg_dump tests for CREATE STATISTICS

---
 src/bin/pg_dump/t/002_pg_dump.pl | 36 +++++++++++++++++++++++++++++++++++-
 1 file changed, 35 insertions(+), 1 deletion(-)

diff --git a/src/bin/pg_dump/t/002_pg_dump.pl b/src/bin/pg_dump/t/002_pg_dump.pl
index ccd0ed6a53..79108cd331 100644
--- a/src/bin/pg_dump/t/002_pg_dump.pl
+++ b/src/bin/pg_dump/t/002_pg_dump.pl
@@ -1053,7 +1053,7 @@ my %tests = (
 		all_runs  => 1,
 		catch_all => 'ALTER TABLE ... commands',
 		create_order => 96,
-		create_sql => 'ALTER TABLE dump_test.test_table CLUSTER ON test_table_pkey',
+		create_sql => 'ALTER TABLE dump_test.test_table CLUSTER ON test_table_pkey;',
 		regexp    => qr/^
 			\QALTER TABLE test_table CLUSTER ON test_table_pkey;\E\n
 			/xm,
@@ -4920,6 +4920,40 @@ qr/CREATE TRANSFORM FOR integer LANGUAGE sql \(FROM SQL WITH FUNCTION pg_catalog
 			role                     => 1,
 			section_post_data        => 1, }, },
 
+	'CREATE STATISTICS extended_stats_no_using' => {
+		all_runs     => 1,
+		catch_all    => 'CREATE ... commands',
+		create_order => 97,
+		create_sql   => 'CREATE STATISTICS dump_test.test_ext_stats_no_using
+							ON (col1, col2) FROM dump_test.test_fifth_table;',
+		regexp => qr/^
+			\QCREATE STATISTICS dump_test.test_ext_stats_no_using ON (col1, col2) FROM test_fifth_table;\E
+		    /xms,
+		like => {
+			binary_upgrade          => 1,
+			clean                   => 1,
+			clean_if_exists         => 1,
+			createdb                => 1,
+			defaults                => 1,
+			exclude_test_table      => 1,
+			exclude_test_table_data => 1,
+			no_blobs                => 1,
+			no_privs                => 1,
+			no_owner                => 1,
+			only_dump_test_schema   => 1,
+			pg_dumpall_dbprivs      => 1,
+			schema_only             => 1,
+			section_post_data       => 1,
+			test_schema_plus_blobs  => 1,
+			with_oids               => 1, },
+		unlike => {
+			exclude_dump_test_schema => 1,
+			only_dump_test_table     => 1,
+			pg_dumpall_globals       => 1,
+			pg_dumpall_globals_clean => 1,
+			role                     => 1,
+			section_pre_data         => 1, }, },
+
 	'CREATE SEQUENCE test_table_col1_seq' => {
 		all_runs  => 1,
 		catch_all => 'CREATE ... commands',
-- 
2.11.0

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Attachments:

  [text/plain] 0001-Add-pg_dump-tests-for-CREATE-STATISTICS.patch (2.3K, ../20170503172746.rwftidszir67sgk7@alvherre.pgsql/2-0001-Add-pg_dump-tests-for-CREATE-STATISTICS.patch)
  download | inline diff:
From 1dcb16de656d48c1004d4f4a12475438618a5c72 Mon Sep 17 00:00:00 2001
From: Alvaro Herrera <alvherre@alvh.no-ip.org>
Date: Wed, 3 May 2017 14:18:22 -0300
Subject: [PATCH] Add pg_dump tests for CREATE STATISTICS

---
 src/bin/pg_dump/t/002_pg_dump.pl | 36 +++++++++++++++++++++++++++++++++++-
 1 file changed, 35 insertions(+), 1 deletion(-)

diff --git a/src/bin/pg_dump/t/002_pg_dump.pl b/src/bin/pg_dump/t/002_pg_dump.pl
index ccd0ed6a53..79108cd331 100644
--- a/src/bin/pg_dump/t/002_pg_dump.pl
+++ b/src/bin/pg_dump/t/002_pg_dump.pl
@@ -1053,7 +1053,7 @@ my %tests = (
 		all_runs  => 1,
 		catch_all => 'ALTER TABLE ... commands',
 		create_order => 96,
-		create_sql => 'ALTER TABLE dump_test.test_table CLUSTER ON test_table_pkey',
+		create_sql => 'ALTER TABLE dump_test.test_table CLUSTER ON test_table_pkey;',
 		regexp    => qr/^
 			\QALTER TABLE test_table CLUSTER ON test_table_pkey;\E\n
 			/xm,
@@ -4920,6 +4920,40 @@ qr/CREATE TRANSFORM FOR integer LANGUAGE sql \(FROM SQL WITH FUNCTION pg_catalog
 			role                     => 1,
 			section_post_data        => 1, }, },
 
+	'CREATE STATISTICS extended_stats_no_using' => {
+		all_runs     => 1,
+		catch_all    => 'CREATE ... commands',
+		create_order => 97,
+		create_sql   => 'CREATE STATISTICS dump_test.test_ext_stats_no_using
+							ON (col1, col2) FROM dump_test.test_fifth_table;',
+		regexp => qr/^
+			\QCREATE STATISTICS dump_test.test_ext_stats_no_using ON (col1, col2) FROM test_fifth_table;\E
+		    /xms,
+		like => {
+			binary_upgrade          => 1,
+			clean                   => 1,
+			clean_if_exists         => 1,
+			createdb                => 1,
+			defaults                => 1,
+			exclude_test_table      => 1,
+			exclude_test_table_data => 1,
+			no_blobs                => 1,
+			no_privs                => 1,
+			no_owner                => 1,
+			only_dump_test_schema   => 1,
+			pg_dumpall_dbprivs      => 1,
+			schema_only             => 1,
+			section_post_data       => 1,
+			test_schema_plus_blobs  => 1,
+			with_oids               => 1, },
+		unlike => {
+			exclude_dump_test_schema => 1,
+			only_dump_test_table     => 1,
+			pg_dumpall_globals       => 1,
+			pg_dumpall_globals_clean => 1,
+			role                     => 1,
+			section_pre_data         => 1, }, },
+
 	'CREATE SEQUENCE test_table_col1_seq' => {
 		all_runs  => 1,
 		catch_all => 'CREATE ... commands',
-- 
2.11.0

view thread (45+ messages)  latest in thread

Message-ID: <20170503172746.rwftidszir67sgk7@alvherre.pgsql>
Permalink:  ../20170503172746.rwftidszir67sgk7@alvherre.pgsql/
Also on:    postgresql.org/message-id/20170503172746.rwftidszir67sgk7@alvherre.pgsql

 ·  · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-hackers@postgresql.org
  Cc: alvherre@2ndquadrant.com, simon@2ndquadrant.com, tomas.vondra@2ndquadrant.com, sfrost@snowman.net
  Subject: Re: WITH clause in CREATE STATISTICS
  In-Reply-To: <20170503172746.rwftidszir67sgk7@alvherre.pgsql>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox