Thread: Permission denied for language pltclu

Permission denied for language pltclu

From
"Dinesh Pandey"
Date:

Hi,

 

I am using Postgres-.8.0.1.

 

I am creating a function with ‘pltclu’ language. I have already created database with ‘pltclu’ language. But on creation this function I am getting this error and failed to create this function

-------------------------

ERROR: Permission denied for language pltclu

-------------------------

What is the cause?

Regards
Dinesh Pandey



----------------------------------------------------------------------------------

Dinesh Pandey 
Sr. Software Engineer

Second Foundation (India) Pvt. Ltd.
Plot# 52
Industrial Area, Phase II
Chandigarh. (India)
PH: (O) 0172-2639202, Extn: 233

 

Re: Permission denied for language pltclu

From
Michael Glaesemann
Date:
On Jun 10, 2005, at 4:10 PM, Dinesh Pandey wrote:
> I am using Postgres-.8.0.1.
>
>
>
> I am creating a function with ‘pltclu’ language. I have already
> created database with ‘pltclu’language. But on creation this
> function I am getting this error and failed to create this function
>
> -------------------------
>
> ERROR: Permission denied for language pltclu
>
> -------------------------
>
> What is the cause?

It means that the user you are creating the function as does not have
permission to use pltclu. Only superusers can create functions using
untrusted languages.

http://www.postgresql.org/docs/8.0/interactive/pltcl.html

Hope this helps.

Michael Glaesemann
grzm myrealbox com

Re: Permission denied for language pltclu

From
"Dinesh Pandey"
Date:

I have installed the Postgres from “postgres” user with pltcl option and able to create these function with another dbUSER successfully and never get this error.

 

But our client is getting this error, How to solve it now? Any Idea?

 

 

Thanks

Dinesh Pandey

 

-----Original Message-----
From: Michael Glaesemann [mailto:grzm@myrealbox.com]
Sent: Friday, June 10, 2005 12:58 PM
To: dpandey@secf.com
Cc: pgsql-general@postgresql.org; 'PostgreSQL'
Subject: Re: [SQL] Permission denied for language pltclu

 

 

On Jun 10, 2005, at 4:10 PM, Dinesh Pandey wrote:

> I am using Postgres-.8.0.1.

> I am creating a function with ‘pltclu’ language. I have already 

> created database with ‘pltclu’language. But on creation this 

> function I am getting this error and failed to create this function

> -------------------------

> ERROR: Permission denied for language pltclu

> -------------------------

> What is the cause?

 

It means that the user you are creating the function as does not have 

permission to use pltclu. Only superusers can create functions using 

untrusted languages.

 

http://www.postgresql.org/docs/8.0/interactive/pltcl.html

 

Hope this helps.

 

Michael Glaesemann

grzm myrealbox com

Re: Permission denied for language pltclu

From
Richard Huxton
Date:
Dinesh Pandey wrote:
> I have installed the Postgres from "postgres" user with pltcl option and
> able to create these function with another dbUSER successfully and never get
> this error.
>
> But our client is getting this error, How to solve it now? Any Idea?

If you created an untrusted function as user "dbUSER" then it was a
superuser too. Honest.

--
   Richard Huxton
   Archonet Ltd

Re: Permission denied for language pltclu

From
"Dinesh Pandey"
Date:
Sorry I didn't get it exactly. Because the same function (send e-mail) I am
able to create at my end, but our client is not able to create it at their
end.

1. Is there some problem in installation?
Or
2. Problem with system user permission executing that database?
OR
3. Problem With Database user permission?

Now how to change permission of that user to be able to create this
function?

----------------------------
If you created an untrusted function as user "dbUSER" then it was a
superuser too. Honest.
----------------------------

Thanks
Dinesh



Re: Permission denied for language pltclu

From
Michael Glaesemann
Date:
On Jun 10, 2005, at 5:38 PM, Dinesh Pandey wrote:

> Sorry I didn't get it exactly. Because the same function (send e-
> mail) I am
> able to create at my end, but our client is not able to create it
> at their
> end.
>
> 1. Is there some problem in installation?

No.

> Or
> 2. Problem with system user permission executing that database?

No.

> OR
> 3. Problem With Database user permission?

Only a superuser can create a pltclu function. "dbUSER" must be a
PostgreSQL superuser if it created the pltclu function. You client
must use a PostgreSQL superuser to create a pltclu function.

> Now how to change permission of that user to be able to create this
> function?

Make sure the user creating the function is a PostgreSQL superuser.

Michael Glaesemann
grzm myrealbox com

Re: Permission denied for language pltclu

From
Richard Huxton
Date:
Dinesh Pandey wrote:
> Sorry I didn't get it exactly. Because the same function (send e-mail) I am
> able to create at my end, but our client is not able to create it at their
> end.
>
> 1. Is there some problem in installation?
> 2. Problem with system user permission executing that database?
> 3. Problem With Database user permission?

Number 3 - it is to do with a PostgreSQL user account. That user needs
to be a superuser.

> Now how to change permission of that user to be able to create this
> function?

A good place to start with this sort of thing is the manuals. In the 7.4
manuals, I'd start with:
  Ch 36.1. Installing Procedural Languages
  Ch 17.2. User Attributes
  Reference I - the "ALTER USER" command

Note that you may want to make the client's user a superuser just long
enough to install the language and/or functions.
--
   Richard Huxton
   Archonet Ltd

Re: Permission denied for language pltclu

From
"Dinesh Pandey"
Date:

> OR

> 3. Problem With Database user permission?

 

Only a superuser can create a pltclu function. "dbUSER" must be a 

PostgreSQL superuser if it created the pltclu function. You client 

must use a PostgreSQL superuser to create a pltclu function.

 

What do mean with super user. The user who has installed the Postgres (like I have installed it using "Postgres" user) and initialized the pgsql/data?

I am able to create this pltcl function with another "dataman" user but the same getting failed at out client end.

 

Now pls tell me how to fix it, so that I can tell our client.

 

> Now how to change permission of that user to be able to create this

> function?

 

Make sure the user creating the function is a PostgreSQL superuser.

 

Re: [GENERAL] Permission denied for language pltclu

From
"Dinesh Pandey"
Date:

Hi Richard/ Michael

 

Thanks for your great help.

 

I got the problem.

 

Actually, I was not getting the cause of this problem, because it was working properly at our end.

 

Actually this problem occurs when the function is being created by the user who has not created the current database.

 

Solution: The database must be created by the user who is creating the pltcl function? Right

 

Thanks

Dinesh Pandey

 

 

-----Original Message-----
From: pgsql-general-owner@postgresql.org [mailto:pgsql-general-owner@postgresql.org] On Behalf Of Richard Huxton
Sent: Friday, June 10, 2005 2:41 PM
To: dpandey@secf.com
Cc: 'Michael Glaesemann'; pgsql-general@postgresql.org; 'PostgreSQL'
Subject: Re: [GENERAL] [SQL] Permission denied for language pltclu

 

Dinesh Pandey wrote:

> Sorry I didn't get it exactly. Because the same function (send e-mail) I am

> able to create at my end, but our client is not able to create it at their

> end.

>

> 1. Is there some problem in installation?

> 2. Problem with system user permission executing that database?

> 3. Problem With Database user permission?

 

Number 3 - it is to do with a PostgreSQL user account. That user needs

to be a superuser.

 

> Now how to change permission of that user to be able to create this

> function?

 

A good place to start with this sort of thing is the manuals. In the 7.4

manuals, I'd start with:

  Ch 36.1. Installing Procedural Languages

  Ch 17.2. User Attributes

  Reference I - the "ALTER USER" command

 

Note that you may want to make the client's user a superuser just long

enough to install the language and/or functions.

--

   Richard Huxton

   Archonet Ltd

 

---------------------------(end of broadcast)---------------------------

TIP 4: Don't 'kill -9' the postmaster

Re: [GENERAL] Permission denied for language pltclu

From
Richard Huxton
Date:
Dinesh Pandey wrote:
> Hi Richard/ Michael
>
> Thanks for your great help.
>
> I got the problem.
>
> Actually, I was not getting the cause of this problem, because it was
> working properly at our end.
>
> Actually this problem occurs when the function is being created by the user
> who has not created the current database.
>
> Solution: The database must be created by the user who is creating the pltcl
> function? Right

Not quite. Read the chapter on users I mentioned in the manuals. Then,
try a "SELECT * FROM pg_user" and look at the "usesuper" column. Then,
try "ALTER USER username CREATEUSER" and "ALTER USER username
NOCREATEUSER" - see how these affect pg_user.

In short, a "superuser" is a user who can create other users.

--
   Richard Huxton
   Archonet Ltd

Re: [GENERAL] Permission denied for language pltclu

From
Michael Glaesemann
Date:
On Jun 10, 2005, at 6:51 PM, Dinesh Pandey wrote:
> Actually this problem occurs when the function is being created by
> the user who has not created the current database.
>
>
>
> Solution: The database must be created by the user who is creating
> the pltcl function? Right
This is a coincidence.

Only a PostgreSQL superuser can create a database, so a user who
created the database will be a superuser. Only a superuser can create
a function with an untrusted language. So, the same superuser can
both create a database and create the function using pltclu. However,
*any* PostgreSQL superuser should be able to create such a function,
regardless of whether they created the database or not.

Michael Glaesemann
grzm myrealbox com


Re: [GENERAL] Permission denied for language pltclu

From
Michael Glaesemann
Date:
On Jun 10, 2005, at 7:26 PM, Michael Glaesemann wrote:

>
> On Jun 10, 2005, at 6:51 PM, Dinesh Pandey wrote:
>
>> Actually this problem occurs when the function is being created by
>> the user who has not created the current database.
>>
>>
>>
>> Solution: The database must be created by the user who is creating
>> the pltcl function? Right
>>
> This is a coincidence.
>
> Only a PostgreSQL superuser can create a database, so a user who
> created the database will be a superuser. Only a superuser can
> create a function with an untrusted language. So, the same
> superuser can both create a database and create the function using
> pltclu. However, *any* PostgreSQL superuser should be able to
> create such a function, regardless of whether they created the
> database or not.


Ach! Should have checked the docs before I mailed. I'm wrong about
only superusers creating databases. Richard's got it all right. :)

Michael Glaesemann
grzm myrealbox com

Re: [GENERAL] Permission denied for language pltclu

From
"Dinesh Pandey"
Date:

In short, a "superuser" is a user who can create other users.

 

But if the user is not super user, he is not allowed to install the language 'plpgsql' and 'pltcl' for database.

 

But my problem was the language is already installed but getting error on creation of the function.

 

And if any one is creating this function who is not owner of database, this problem occurs.

 

 

Thanks

Dinesh Pandey

 

Re: [GENERAL] Permission denied for language pltclu

From
Richard Huxton
Date:
Tino Wildenhain wrote:
>
> No :-) But if you are able to create databases, you are a superuser :-)
> And as a superuser you can also create the untrusted functions.

Not quite - if you can create USERS you are a superuser.

--
   Richard Huxton
   Archonet Ltd