Re: [GENERAL] how to check if a database exists programatically

2005-12-08 Thread Devrim GUNDUZ
Hi, On Thu, 2005-12-08 at 14:20 +0200, Devrim GUNDUZ wrote: > SELECT 1 from pg_database WHERE datname='abc'; Ah of course: $ psql template1 -U postgres -c "SELECT 1 AS result FROM pg_database WHERE datname='yapab'"; result 1 (1 row) $ psql template1 -U postgres -c "SELECT 1 AS

Re: [GENERAL] how to check if a database exists programatically

2005-12-08 Thread Devrim GUNDUZ
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='a

Re: [GENERAL] how to check if a database exists programatically

2005-12-08 Thread A. Kretschmer
am 08.12.2005, um 17:25:10 +0530 mailte surabhi.ahuja folgendes: > 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'; You can parse the output from 'psql

[GENERAL] how to check if a database exists programatically

2005-12-08 Thread surabhi.ahuja
 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';