On 19/04/15 01:24, Michael Paquier wrote:
On Sat, Apr 18, 2015 at 8:38 PM, Michael Paquier
<michael.paqu...@gmail.com> wrote:
On Fri, Apr 17, 2015 at 10:54 PM, Petr Jelinek wrote:
On 10/04/15 06:46, Michael Paquier wrote:
13) Some regression tests with pg_tablesample_method would be welcome.
Not sure what you mean by that.
I meant a sanity check on pg_tablesample_method to be sure that
tsminit, tsmnextblock and tsmnexttuple are always defined as they are
mandatory functions. So the idea is to add a query like and and to be
sure that it returns no rows:
SELECT tsmname FROM pg_tablesample_method WHERE tsminit IS NOT NULL OR
tsmnextblock IS NOT NULL OR tsmnexttuple IS NOT NULL;
Yesterday was a long day. I meant IS NULL and not IS NOT NULL, but I
am sure you guessed it that way already..
Yes I guessed that and it's very reasonable request, I guess it should
look like the attached (I don't want to send new version of everything
just for this).
--
Petr Jelinek http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services
>From d059c792a1e864e38f321cea51169ea0b3c5caab Mon Sep 17 00:00:00 2001
From: Petr Jelinek <pjmo...@pjmodos.net>
Date: Wed, 22 Apr 2015 21:28:29 +0200
Subject: [PATCH 7/7] tablesample: add catalog regression test
---
src/test/regress/expected/tablesample.out | 15 +++++++++++++++
src/test/regress/sql/tablesample.sql | 13 +++++++++++++
2 files changed, 28 insertions(+)
diff --git a/src/test/regress/expected/tablesample.out b/src/test/regress/expected/tablesample.out
index 271638d..04e5eb8 100644
--- a/src/test/regress/expected/tablesample.out
+++ b/src/test/regress/expected/tablesample.out
@@ -209,6 +209,21 @@ SELECT q.* FROM (SELECT * FROM test_tablesample) as q TABLESAMPLE BERNOULLI (5);
ERROR: syntax error at or near "TABLESAMPLE"
LINE 1: ...CT q.* FROM (SELECT * FROM test_tablesample) as q TABLESAMPL...
^
+-- catalog sanity
+SELECT *
+FROM pg_tablesample_method
+WHERE tsminit IS NULL
+ OR tsmseqscan IS NULL
+ OR tsmpagemode IS NULL
+ OR tsmnextblock IS NULL
+ OR tsmnexttuple IS NULL
+ OR tsmend IS NULL
+ OR tsmreset IS NULL
+ OR tsmcost IS NULL;
+ tsmname | tsmseqscan | tsmpagemode | tsminit | tsmnextblock | tsmnexttuple | tsmexaminetuple | tsmend | tsmreset | tsmcost
+---------+------------+-------------+---------+--------------+--------------+-----------------+--------+----------+---------
+(0 rows)
+
-- done
DROP TABLE test_tablesample CASCADE;
NOTICE: drop cascades to 2 other objects
diff --git a/src/test/regress/sql/tablesample.sql b/src/test/regress/sql/tablesample.sql
index 2f4b7de..7b3eb9b 100644
--- a/src/test/regress/sql/tablesample.sql
+++ b/src/test/regress/sql/tablesample.sql
@@ -57,5 +57,18 @@ SELECT * FROM query_select TABLESAMPLE BERNOULLI (5.5) REPEATABLE (1);
SELECT q.* FROM (SELECT * FROM test_tablesample) as q TABLESAMPLE BERNOULLI (5);
+-- catalog sanity
+
+SELECT *
+FROM pg_tablesample_method
+WHERE tsminit IS NULL
+ OR tsmseqscan IS NULL
+ OR tsmpagemode IS NULL
+ OR tsmnextblock IS NULL
+ OR tsmnexttuple IS NULL
+ OR tsmend IS NULL
+ OR tsmreset IS NULL
+ OR tsmcost IS NULL;
+
-- done
DROP TABLE test_tablesample CASCADE;
--
1.9.1
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers