Re: My troubles with test PostgreSQL 8.1

John DeSoi <[email protected]> Wed, 9 Nov 2005 20:23:14 -0500
Newsgroups gmane.lisp.clsql.devel
Message-ID <[email protected]>
On Nov 9, 2005, at 4:29 PM, Kevin Rosenberg wrote:

> If you look at db-postgresql/postgresql-sql.lisp, you'll see that
> database-destory invokes the shell command dropdb to drop the
> database. That has the limitation you identified. AFAIK, postgresql
> doesn't allow the ability to idenify the spec user/password for
> dropping the database.

The parameters to dropdb is similar to all PostgreSQL command line  
utilities:

dropdb --help
dropdb removes a PostgreSQL database.

Usage:
   dropdb [OPTION]... DBNAME

Options:
   -e, --echo                show the commands being sent to the server
   -i, --interactive         prompt before deleting anything
   -q, --quiet               don't write any messages
   -h, --host=HOSTNAME       database server host or socket directory
   -p, --port=PORT           database server port
   -U, --username=USERNAME   user name to connect as
   -W, --password            prompt for password
   --help                    show this help, then exit
   --version                 output version information, then exit

Of course, getting the password in there with some kind of shell  
command is tricky, especially with different Lisp environments. There  
are other methods like setting up a .pgpass file to get around the  
password prompting.


But as far back as I remember, PostgreSQL has had a DROP DATABASE  
command so I'm not sure why you would use the shell command other  
than perhaps you don't have to specify a database to connect to.

http://www.postgresql.org/docs/8.0/interactive/sql-dropdatabase.html



John DeSoi, Ph.D.
http://pgedit.com/
Power Tools for PostgreSQL