On 2015-06-19 00:38, Petr Jelinek wrote:
On 2015-06-18 22:04, Tom Lane wrote:

By the by, the tablesample additions to range_table_mutator are obviously
broken.


Bah, typos. Attached patch corrects them.


Actually it should probably look more like this, sorry.


--
 Petr Jelinek                  http://www.2ndQuadrant.com/
 PostgreSQL Development, 24x7 Support, Training & Services
diff --git a/src/backend/nodes/nodeFuncs.c b/src/backend/nodes/nodeFuncs.c
index a2bcca5..1c89abb 100644
--- a/src/backend/nodes/nodeFuncs.c
+++ b/src/backend/nodes/nodeFuncs.c
@@ -2870,9 +2870,10 @@ range_table_mutator(List *rtable,
 			case RTE_RELATION:
 				if (rte->tablesample)
 				{
-					MUTATE(rte->tablesample->args, rte->tablesample->args,
+					FLATCOPY(newrte->tablesample, rte->tablesample, TableSampleClause);
+					MUTATE(newrte->tablesample->args, rte->tablesample->args,
 						   List *);
-					MUTATE(rte->tablesample->repeatable,
+					MUTATE(newrte->tablesample->repeatable,
 						   rte->tablesample->repeatable, Node *);
 				}
 				break;
diff --git a/src/test/regress/sql/tablesample.sql b/src/test/regress/sql/tablesample.sql
index 7b3eb9b..2be5d85 100644
--- a/src/test/regress/sql/tablesample.sql
+++ b/src/test/regress/sql/tablesample.sql
@@ -1,4 +1,5 @@
 CREATE TABLE test_tablesample (id int, name text) WITH (fillfactor=10); -- force smaller pages so we don't have to load too much data to get multiple pages
+CREATE TABLE test_tablesample_inh() INHERITS (test_tablesample);
 
 INSERT INTO test_tablesample SELECT i, repeat(i::text, 200) FROM generate_series(0, 9) s(i) ORDER BY i;
 
-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to