Seems that crosstab function expect only one column to hold the row identification, and, if I got that right, you have 3 columns: day, name and hour. But crosstab also allow extra columns, that it doesn't treat it as special, it just add it to the result.
So, for your case you must get these three columns and represent them as only one. I'm not sure if it is the best approach, but I used the row constructor to do that (so we don't need to care about data types):
SELECT * from crosstab (
'select row(day,hour,name),day, hour, name, cause, sum(c_p) as c_p
from t
group by 2, 3, 4, 5
order by 1',
'VALUES(0),(1)')
AS t_pivot (row_name text, day date, hour int, name integer, cause_0 integer,cause_1 integer);
This will give a result like this:
row_name | day | hour | name | cause_0 | cause_1
---------------------+------------+------+------+---------+---------
(2013-06-12,14,167) | 2013-06-12 | 14 | 167 | 2 | --
(2013-06-12,16,167) | 2013-06-12 | 16 | 167 | 7 | --
(2013-06-12,19,167) | 2013-06-12 | 19 | 167 | 4 | 1
(2013-06-13,14,167) | 2013-06-13 | 14 | 167 | 10 | --
(4 rows)
You don't need to worry with the first column, it is actually useless for you, so we can just remove it:
SELECT day,hour,name,cause_0,cause_1 FROM (SELECT * from crosstab (
'select row(day,hour,name),day, hour, name, cause, sum(c_p) as c_p
from t
group by 2, 3, 4, 5
order by 1',
'VALUES(0),(1)')
AS t_pivot (row_name text, day date, hour int, name integer, cause_0 integer,cause_1 integer)) AS t;
One more thing. Notice that I used VALUES for the second argument instead of SELECT DISTINCT, it is a better approach if you are sure these will be the only available values, if it is not static, then the AS t_pivot ... should be dynamic also.