Re: BUG #4980: Dblink issue

Lists: pgsql-bugs
From: "Gaurav K Srivastava" <gauravgkp(at)gmail(dot)com>
To: pgsql-bugs(at)postgresql(dot)org
Subject: BUG #4980: Dblink issue
Date: 2009-08-12 12:00:03
Message-ID: 200908121200.n7CC03tW008646@wwwmaster.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-bugs


The following bug has been logged online:

Bug reference: 4980
Logged by: Gaurav K Srivastava
Email address: gauravgkp(at)gmail(dot)com
PostgreSQL version: 8.3
Operating system: Windows xp
Description: Dblink issue
Details:

I have created a user by command

1: create user posuser with password ‘pos’;
2: create database chserver with owner = abc;
3: GRANT ALL PRIVILEGES ON database chserver TO posuser

Now I have a schema under it named 'pos'

Now there is a table 'tickets' ie pos.tickets

Now I want to make a trigger which link another database say it is chclient
using dblink while inserting any row in tickets table.

then i got dblink function is undefined.

after running contrib/dblink.sql
i got the error while using dblink
is
ERROR: permission denied for language c

and when I run the command

ALTER PROCEDURAL LANGUAGE C OWNER TO posuser;

then also I got the same error.

Please tell me how i make the dblink function available to posuser which is
non super user.


From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Gaurav K Srivastava <gauravgkp(at)gmail(dot)com>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #4980: Dblink issue
Date: 2009-08-13 14:02:07
Message-ID: 603c8f070908130702o2412a5ceja7f0c6d61c1077dd@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-bugs

On Wed, Aug 12, 2009 at 8:00 AM, Gaurav K Srivastava<gauravgkp(at)gmail(dot)com> wrote:
>
> The following bug has been logged online:
>
> Bug reference:      4980
> Logged by:          Gaurav K Srivastava
> Email address:      gauravgkp(at)gmail(dot)com
> PostgreSQL version: 8.3
> Operating system:   Windows xp
> Description:        Dblink issue
> Details:
>
> I have created a user by command
>
>
> 1:      create user posuser with password ‘pos’;
> 2:      create database chserver with owner = abc;
> 3:      GRANT ALL PRIVILEGES ON database chserver TO posuser
>
>
> Now I have a schema under it named 'pos'
>
> Now there is a table 'tickets' ie pos.tickets
>
> Now I want to make a trigger which link another database say it is chclient
> using dblink while inserting any row in tickets table.
>
> then i got dblink function is undefined.
>
> after running contrib/dblink.sql
> i got the error while using  dblink
> is
> ERROR: permission denied for language c
>
> and when I run the command
>
> ALTER PROCEDURAL LANGUAGE C OWNER TO posuser;
>
> then also I got the same error.
>
> Please tell me how i make the dblink function available to posuser which is
> non super user.

http://www.postgresql.org/docs/current/static/sql-grant.html

I suspect you want some variant of "GRANT USAGE ON LANGUAGE ...".

...Robert


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Gaurav K Srivastava <gauravgkp(at)gmail(dot)com>, pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #4980: Dblink issue
Date: 2009-08-13 14:15:37
Message-ID: 6629.1250172937@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-bugs

Robert Haas <robertmhaas(at)gmail(dot)com> writes:
> On Wed, Aug 12, 2009 at 8:00 AM, Gaurav K Srivastava<gauravgkp(at)gmail(dot)com> wrote:
>> Please tell me how i make the dblink function available to posuser which is
>> non super user.

> I suspect you want some variant of "GRANT USAGE ON LANGUAGE ...".

C-language functions have to be created by a superuser. They might be
*used* by a non superuser afterwards, but you have to be superuser to
run the "dblink.sql" script. I'm fairly sure that GRANT will not
override this. Since anyone with the power to load arbitrary code into
the backend could make himself a superuser pretty easily, it's a bit
foolish to imagine that granting this privilege to non-superusers
is a good idea.

regards, tom lane