Re: how to check if a database exists programatically

From: Devrim GUNDUZ <devrim(at)commandprompt(dot)com>
To: "surabhi(dot)ahuja" <surabhi(dot)ahuja(at)iiitb(dot)ac(dot)in>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: how to check if a database exists programatically
Date: 2005-12-08 12:20:09
Message-ID: 1134044409.21190.0.camel@linux.site
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi,

On Thu, 2005-12-08 at 17:25 +0530, surabhi.ahuja wrote:
> i have to write a shell script in which i have to check if the
> database "abc" exists or not
>
> how should i do it ? some select query
>
> select * from ??? where database_name = 'abc';

SELECT 1 from pg_database WHERE datname='abc';

Regards,
--
The PostgreSQL Company - Command Prompt, Inc. 1.503.667.4564
PostgreSQL Replication, Consulting, Custom Development, 24x7 support
Managed Services, Shared and Dedicated Hosting
Co-Authors: plPHP, plPerlNG - http://www.commandprompt.com/

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message gabor 2005-12-08 12:20:56 is it possible to delete the psql log while psql is running?
Previous Message A. Kretschmer 2005-12-08 12:11:41 Re: how to check if a database exists programatically