Re: How to query information schema from shell script

From: "Jon Horsman" <horshaq(at)gmail(dot)com>
To: "Scott Marlowe" <smarlowe(at)g2switchworks(dot)com>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: How to query information schema from shell script
Date: 2006-10-28 15:18:52
Message-ID: 4f4c2a010610280818u76670cf0x2da8ec3efebcd3fc@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

I ended up going the pg_catalog route, something like (off the top of
my head without a linux machine by to test it)

output=$(psql -d template1 -t -c "select * from pg_database where
datname='testdb'")
if [ -z "$output" ]; then
psql createdb testdb
else
echo 'the db already exists'
fi

I did the exact same thing for the user using pg_user and usename

Jon

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Bobus 2006-10-29 16:36:48 fetching unique pins in a high-transaction environment...
Previous Message Richard Broersma Jr 2006-10-28 14:59:09 Re: Case Preservation disregarding case sensitivity?