Return-Path: pg_adm@postgres.berkeley.edu
Received: by postgres.Berkeley.EDU (5.61/1.29)
	id AA23696; Tue, 13 Oct 92 15:29:42 -0700
Date: Tue, 13 Oct 92 15:29:42 -0700
Message-Id: <9210132229.AA23696@postgres.Berkeley.EDU>
From: bunting@pangaea.dme.nt.gov.au (Chris Bunting 95334)
Subject: Re: valid database check with libpq
To: postgres@postgres.berkeley.edu
Sender: pg_adm@postgres.berkeley.edu
Cc: postgres@postgres.Berkeley.EDU

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
> pml@cacs.usl.edu
> 
>

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. 
