Andres Freund <andres@2ndquadrant.com> wrote:
> giving an error so its an easy to find distinction to a normal
> table seems like a good idea.
I'm not sure I understood your concerns entirely, but wonder
whether this helps?:
test=# \d
List of relations
Schema | Name | Type | Owner
--------+-------+-------------------+---------
public | bb | materialized view | kgrittn
public | t | table | kgrittn
public | tm | materialized view | kgrittn
public | tmm | materialized view | kgrittn
public | tv | view | kgrittn
public | tvmm | materialized view | kgrittn
public | tvv | view | kgrittn
public | tvvm | materialized view | kgrittn
public | tvvmv | view | kgrittn
(9 rows)
test=# truncate table tm;
ERROR: "tm" is not a table
test=# truncate materialized view t;
ERROR: "t" is not a materialized view
test=# truncate materialized view tm;
TRUNCATE TABLE
test=# truncate table t;
TRUNCATE TABLE
Well, maybe those command tags could use a tweak.
Then there's this, if you don't specify an object type:
test=# truncate t, tm;
TRUNCATE TABLE
--
Kevin Grittner
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company