--
-- New CLUSTER tests
--

drop table if exists foo;
create table foo (col1 serial, col2 text);
insert into foo (col2) select repeat('a', 5000) from generate_series(1,1000);
create index on foo (col1);


drop table if exists footemp;
create temp table footemp (col1 serial, col2 text);
insert into footemp (col2) select repeat('a', 5000) from generate_series(1,1000);
create index on footemp (col1);

select c.oid, c.relname, c.relfilenode, c.reltoastrelid, t.oid, t.relname, t.relfilenode, c.relisshared
from pg_class c left outer join pg_class t on c.reltoastrelid = t.oid where c.relnamespace = 2200;
cluster foo using foo_col1_idx;
vacuum full foo;

select c.oid, c.relname, c.relfilenode, c.reltoastrelid, t.oid, t.relname, t.relfilenode, c.relisshared
from pg_class c left outer join pg_class t on c.reltoastrelid = t.oid where c.relnamespace = 2200;

cluster footemp using footemp_col1_idx;
vacuum full footemp;

select c.oid, c.relname, c.relfilenode, c.reltoastrelid, t.oid, t.relname, t.relfilenode, c.relisshared
from pg_class c left outer join pg_class t on c.reltoastrelid = t.oid where c.relnamespace = 2200;

