Unix Technical Forum

Scripting postgres commands

This is a discussion on Scripting postgres commands within the pgsql Admins forums, part of the PostgreSQL category; --> I can run the following command from a command prompt with no problem on mydatabase. /usr/bin/vacuumdb --verbose --analyze --all ...


Go Back   Unix Technical Forum > Database Server Software > PostgreSQL > pgsql Admins

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-10-2008, 08:18 AM
Ferry, Craig
 
Posts: n/a
Default Scripting postgres commands

I can run the following command from a command prompt with no problem on mydatabase.

/usr/bin/vacuumdb --verbose --analyze --all -U postgres

But if I try to execute it via a bash shell script, I receive the followingerror. The role does exist in the database.

does not existnot connect to database postgres: FATAL: role "postgres

I am new to postgresql so any help would be greatly appreciated.

Thanks

Craig

*
________________________________________
*
*Craig Ferry
*Sr. Database Administrator
*WESCO Distribution, Inc.
*Suite 700
*225 West Station Square Drive
*Pittsburgh, PA 15219
*P:412-454-2835
*F:412-222-7535
*crferry@wescodist.com
________________________________________


---------------------------(end of broadcast)---------------------------
TIP 3: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faq

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 04-10-2008, 08:18 AM
Tom Lane
 
Posts: n/a
Default Re: Scripting postgres commands

"Ferry, Craig" <crferry@wescodist.com> writes:
> I can run the following command from a command prompt with no problem on my database.
> /usr/bin/vacuumdb --verbose --analyze --all -U postgres


> But if I try to execute it via a bash shell script, I receive the following error. The role does exist in the database.


> does not existnot connect to database postgres: FATAL: role "postgres


> I am new to postgresql so any help would be greatly appreciated.


Given the curious formatting of the complaint, it looks like what the
database is actually seeing as the requested username is "postgres\r"
(ie, there's a carriage return or perhaps a newline character tacked
onto the name). Better check your quoting in the shell script.

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 3: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faq

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 10:38 PM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com