Thread: 'cluster' messes up a table

'cluster' messes up a table

From
postgres@vrane.com
Date:
I don't know if this is a feature or
bug but my experiment with 'cluster'
went hay wire.

Version is 7.2.1

Clustering one index on a table
kills all other indices as well
as remove permissions.

Below is the interactive demonstration
---------------------------------------
what=> drop table t;
DROP
what=> create table t ( a int, b int);
CREATE
what=> create index t_a on t (a);
CREATE
what=> create index t_b on t (b);
CREATE
what=> \d t
          Table "t"
 Column |  Type   | Modifiers
--------+---------+-----------
 a      | integer |
 b      | integer |
Indexes: t_a,
         t_b

what=> grant all on t to httpd;
GRANT
what=> \c - httpd
You are now connected as new user httpd.
what=> insert into t values(1,2);
INSERT 2133431 1
what=> select * from t ;
 a | b
---+---
 1 | 2
(1 row)

what=> \c - pg
You are now connected as new user pg.
what=> cluster t_a on t;
CLUSTER
what=> \c - httpd
You are now connected as new user httpd.
what=> select * from t
what-> ;
ERROR:  t: Permission denied.
ERROR:  t: Permission denied.
what=> \d t
          Table "t"
 Column |  Type   | Modifiers
--------+---------+-----------
 a      | integer |
 b      | integer |
Indexes: t_a



Re: 'cluster' messes up a table

From
Bruce Momjian
Date:
This is documented in the CLUSTER manual page, and we realize it is a
major limitation of the command.

---------------------------------------------------------------------------

postgres@vrane.com wrote:
> I don't know if this is a feature or
> bug but my experiment with 'cluster'
> went hay wire.
>
> Version is 7.2.1
>
> Clustering one index on a table
> kills all other indices as well
> as remove permissions.
>
> Below is the interactive demonstration
> ---------------------------------------
> what=> drop table t;
> DROP
> what=> create table t ( a int, b int);
> CREATE
> what=> create index t_a on t (a);
> CREATE
> what=> create index t_b on t (b);
> CREATE
> what=> \d t
>           Table "t"
>  Column |  Type   | Modifiers
> --------+---------+-----------
>  a      | integer |
>  b      | integer |
> Indexes: t_a,
>          t_b
>
> what=> grant all on t to httpd;
> GRANT
> what=> \c - httpd
> You are now connected as new user httpd.
> what=> insert into t values(1,2);
> INSERT 2133431 1
> what=> select * from t ;
>  a | b
> ---+---
>  1 | 2
> (1 row)
>
> what=> \c - pg
> You are now connected as new user pg.
> what=> cluster t_a on t;
> CLUSTER
> what=> \c - httpd
> You are now connected as new user httpd.
> what=> select * from t
> what-> ;
> ERROR:  t: Permission denied.
> ERROR:  t: Permission denied.
> what=> \d t
>           Table "t"
>  Column |  Type   | Modifiers
> --------+---------+-----------
>  a      | integer |
>  b      | integer |
> Indexes: t_a
>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org
>

--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026