Thread: Grant permission to all objects of user A to user B

Grant permission to all objects of user A to user B

From
"kumar"
Date:
Dear Friends,
 
Postgres 7.3.2.
 
I have an database with owner USRA who owns about 300 objects (tables and functions). Now I want to give 'ALL' permission to all the objects of USRA to another database user USRB.
 
If I use the grant i need to type all the objects as comma separated, like the following
booktown=# GRANT ALL ON customers, books, editions, publishers
booktown-#           TO manager;
CHANGE
Is there any other way do it.
 
Thanks
Kumar

Re: Grant permission to all objects of user A to user B

From
Christoph Haller
Date:
> 
> Dear Friends,
> 
> Postgres 7.3.2.
> 
> I have an database with owner USRA who owns about 300 objects (tables and f=
> unctions). Now I want to give 'ALL' permission to all the objects of USRA t=
> o another database user USRB.
> 
> If I use the grant i need to type all the objects as comma separated, like =
> the following
> booktown=3D# GRANT ALL ON customers, books, editions, publishers
> booktown-#           TO manager;
> CHANGE
> Is there any other way do it.ThanksKumar
> 
> 
If you're using schemas you can grant the whole schema to the new user. 
If not, the only alternative I know about is extract the table/function 
names via \dt / \df commands within psql and use a script to grant the 
privileges. 

Regards, Christoph 



Update is very slow on a bigger table

From
Dimitar Georgievski
Date:
hi,

i'm running an update procedure on a table with approximately 100,000
records. The problem is the procedure is running endlessly even when the
update is very simple like in the following example:

update mytable
set client_id = 1
where mytable_id = 1

mytable_id is the primary key of mytable.

the process under which the update is running reports among the usual
process data "UPDATE waiting".

I'm using PostgreSQL 7.3.4 on SuSE 9.0. From what I have seen it doesn't
look like that the host computer has problem with the resources.

Any idea why is this happening?

thanks,

dimitar



Re: Update is very slow on a bigger table

From
Tom Lane
Date:
Dimitar Georgievski <dgeorgievski@horizonk.com> writes:
> the process under which the update is running reports among the usual
> process data "UPDATE waiting".

I don't think the UPDATE is doing anything at all --- that ps output
implies that it's waiting for some other backend to release an exclusive
lock on the table, or an update lock on one of the rows to be updated.

The pg_locks view might help you determine who's the culprit.
        regards, tom lane


Re: Update is very slow on a bigger table

From
Dimitar Georgievski
Date:
Tom,

Yes. it looks like there was some locking condition in the database. in
the meantime it disappeared and the updates run quickly. 

thanks for your help. this is the first time i'm working with PostgreSQL
and wasn't sure where to look for possible causes of the problem.

thanks,

dimitar

On Thu, 2004-04-15 at 18:51, Tom Lane wrote:
> Dimitar Georgievski <dgeorgievski@horizonk.com> writes:
> > the process under which the update is running reports among the usual
> > process data "UPDATE waiting".
> 
> I don't think the UPDATE is doing anything at all --- that ps output
> implies that it's waiting for some other backend to release an exclusive
> lock on the table, or an update lock on one of the rows to be updated.
> 
> The pg_locks view might help you determine who's the culprit.
> 
>             regards, tom lane



Re: Update is very slow on a bigger table

From
"Yudie"
Date:
Hi guys,
I would like to create a trigger that execute some programs,
is there a way to create a plpgsql function that execute shell command or
any other way to run a program?
Thanks for your help.

Yudie




Re: Update is very slow on a bigger table

From
Bruno Wolff III
Date:
On Fri, Apr 16, 2004 at 12:47:58 -0500, Yudie <yudie@axiontech.com> wrote:
> Hi guys,
> I would like to create a trigger that execute some programs,
> is there a way to create a plpgsql function that execute shell command or
> any other way to run a program?
> Thanks for your help.

Only untrusted languages can be used to run external programs. perlu might
be something you can use.


Re: Update is very slow on a bigger table

From
"scott.marlowe"
Date:
On Sat, 17 Apr 2004, Bruno Wolff III wrote:

> On Fri, Apr 16, 2004 at 12:47:58 -0500,
>   Yudie <yudie@axiontech.com> wrote:
> > Hi guys,
> > I would like to create a trigger that execute some programs,
> > is there a way to create a plpgsql function that execute shell command or
> > any other way to run a program?
> > Thanks for your help.
> 
> Only untrusted languages can be used to run external programs. perlu might
> be something you can use.

Also, take a look at plsh if all you need is to run shell functions:

http://developer.postgresql.org/~petere/pgplsh/



Re: Update is very slow on a bigger table

From
CoL
Date:
hi,

Dimitar Georgievski wrote, On 4/15/2004 23:07:

> hi,
> 
> i'm running an update procedure on a table with approximately 100,000
> records. The problem is the procedure is running endlessly even when the
> update is very simple like in the following example:
> 
> update mytable
> set client_id = 1
> where mytable_id = 1
> 
> mytable_id is the primary key of mytable.
> 
> the process under which the update is running reports among the usual
> process data "UPDATE waiting".
> 
> I'm using PostgreSQL 7.3.4 on SuSE 9.0. From what I have seen it doesn't
> look like that the host computer has problem with the resources.
> 
> Any idea why is this happening?
could be, after you send some info: your table schema, your explain 
analyze result, triggers, or any other info. Any other transaction 
running again mytable while you try to update?

C.