Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

create user

Status
Not open for further replies.

totti24

Programmer
Aug 2, 2002
32
MY
is it possible for me to run the command Create user under a function. let's say i would like to built a function that incorporates this command. if can how can i do it coz i've been getting some errors when performing the create user command. but when i'm performing insert or update in a function, nothing happens and it works fine. please advice.
 
Hi totti24,

What do the error messages say. They may give a clue why the function is failing. It might be because of premissions. Do functions run under the user "postgres", since postgres is the user that is needed to start the postmaster, or do functions run under the user that own the connection and make the call to the function? Also, have you tried to set up a user using a front-end app like perl, php, etc where the SQL need is passed through to the back-end postgres server? This would be the equivalent of of creating the user using the "psql" command line. Is it possible that setting up a new user would work better using SQL pass-through than functions?

LelandJ Leland F. Jackson, CPA
Software - Master (TM)
Nothing Runs Like the Fox
 

hi LelandJ. i've solved the problem. all i need to do is to put the EXECUTE command in front of the create user ... statement. it's diff from insertion and updates. probably bcoz create is a ddl whereas insert and update are dml. that's y the EXECUTE is needed.

and i also found out that postgresql functions can't parse arguments. is it true? coz if i try to create one function that parse arguments, i can't create a trigger for it. the error i get is "function .... doesn't exist". but if i create a function that doesn't parse arguments and returns OPAQUE, i'm able to create the trigger and fire my trigger successfully. hope to get some opinion n advice regarding this function matter.




 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top