Received: from localhost (unknown [200.46.204.184]) by postgresql.org (Postfix) with ESMTP id CFFFA2E0D55 for ; Wed, 19 Dec 2007 13:04:14 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.184]) (amavisd-maia, port 10024) with ESMTP id 58755-03 for ; Wed, 19 Dec 2007 13:03:44 -0400 (AST) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by postgresql.org (Postfix) with ESMTP id 5C2C42E016C for ; Wed, 19 Dec 2007 13:04:11 -0400 (AST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.1/8.14.1) with ESMTP id lBJH4A5K024285; Wed, 19 Dec 2007 12:04:10 -0500 (EST) To: "Ferry, Craig" cc: pgsql-admin@postgresql.org Subject: Re: Scripting postgres commands In-reply-to: <6B6D3063DF0A7A4DB8A989D40C61BEB33817FB@EMAIL02.wescodist.com> References: <6B6D3063DF0A7A4DB8A989D40C61BEB33817FB@EMAIL02.wescodist.com> Comments: In-reply-to "Ferry, Craig" message dated "Wed, 19 Dec 2007 10:43:21 -0500" Date: Wed, 19 Dec 2007 12:04:10 -0500 Message-ID: <24284.1198083850@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200712/179 X-Sequence-Number: 27696 "Ferry, Craig" 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