Re: ERROR: permission denied for database control

From: Albe Laurenz <laurenz(dot)albe(at)wien(dot)gv(dot)at>
To: "Huang, Suya *EXTERN*" <Suya(dot)Huang(at)au(dot)experian(dot)com>, "'pgsql-general General'" <pgsql-general(at)postgresql(dot)org>
Subject: Re: ERROR: permission denied for database control
Date: 2014-05-07 07:37:45
Message-ID: A737B7A37273E048B164557ADEF4A58B17CF6E4F@ntex2010i.host.magwien.gv.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Suya Huang wrote:
> I’ve encountered a weird problem in PostgreSQL :
>
> postgres=> create user test password ‘test’;
>
> postgres=> grant select on pg_catalog.pg_database_size to test;

This statement produces an error:
ERROR: relation "pg_catalog.pg_database_size" does not exist

> postgres=> grant execute on function pg_catalog.pg_database_size(name) to test;
>
> --login as user test
> postgres=> select current_user;
> current_user
> --------------
> test
> (1 row)
>
>
> --query individual database size is fine
> postgres=> select pg_database_size('postgres');
> pg_database_size
> ------------------
> 25611884
> (1 row)
>
> --fails if try to get all db size in one sql
> postgres=> SELECT current_date,pg_database_size(pg_database.datname) from pg_database;
> ERROR: permission denied for database control

Works for me.

It seems like you have a database called "control" for which user "test"
has no connect privilege.

Yours,
Laurenz Albe

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Albe Laurenz 2014-05-07 07:48:16 Re: Oracle to PostgreSQL replication
Previous Message Leif Jensen 2014-05-07 06:37:52 Re: Server process crash - Segmentation fault