Re: Table permissions

From: "A(dot)M(dot)" <agentm(at)themactionfaction(dot)com>
To: salah jubeh <s_jubeh(at)yahoo(dot)com>
Cc: pgsql <pgsql-general(at)postgresql(dot)org>
Subject: Re: Table permissions
Date: 2012-01-18 16:44:06
Message-ID: 749B6FB1-0200-4957-87AD-B62295C0D169@themactionfaction.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


On Jan 18, 2012, at 8:48 AM, salah jubeh wrote:

> Hello,
>
> I have create a table from another table such as
>
> CREATE TABLE tmp_XXX AS SELECT * FROM XXX;
>
>
> The tmp_XXX tables has no permissions assigned to it and I want to assign it with the same owner and access privileges of XXX table. I had a look on pg catalog tables http://www.postgresql.org/docs/8.4/static/catalogs.html to create a stored procedure to do this job for me. I have found some tables which might be useful to get the original table iformation. For example, I can use pg_table to get the owner of the original table. Also, I have found pg_roles. However, I was not able to find where the access privileges are stored.
>
> Is there a better way to do this task than extracting the access privileges from pg catalog ? If not, where I can find the access privileges information ?
>

You are looking for pg_catalog.pg_class.relacl. Just copy that from the original table to the duplicate (and perhaps relowner, depending on your situation), and you will have duplicate permissions.

Cheers,
M

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message David Salisbury 2012-01-18 16:46:32 Re: self referencing table.
Previous Message Oleg Bartunov 2012-01-18 16:40:12 Re: Full text search - How to build a filtering dictionary