Subject: Re: valid database check with libpq

From: [email-masked] (Chris Bunting 95334)
Date: Tue, 13 Oct 92 15:29:42 -0700

You write
> I am accessing postgres using libpq.
> In my C program I get a string from the user which is supposedly the name
> of the database to access. How do I tell if this is a valid database name?
> --
> patrick
> [email-masked]
> 
>

You can query the "template1" datebase with the following query
	retrieve ( pg_database.datname ) where 
		pg_database.datname = "your_string"
if the number of tuples is 1 then the string is a database name.