Re: How to query information schema from shell script

From: "George Pavlov" <gpavlov(at)mynewplace(dot)com>
To: "Jon Horsman" <horshaq(at)gmail(dot)com>, <pgsql-sql(at)postgresql(dot)org>
Subject: Re: How to query information schema from shell script
Date: 2006-10-27 13:47:40
Message-ID: 8C5B026B51B6854CBE88121DBF097A8655C56E@ehost010-33.exch010.intermedia.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

> I'm trying to figure out how i can query the postgres information
> schema from a bourne shell script on linux. I need to know if a
> user/table exists. Does someone mind giving me a quick example of how
> this works, is this possible?

% for tn in `psql -Umnp -dmnp_gp -hstgdb0 -tA -c"select table_name from
information_schema.tables where table_name like 'employee%'"`; do
for> echo FOUND TABLE $tn
for> done
FOUND TABLE employee_role
FOUND TABLE employee

hope this helps,

george

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message William Leite Araújo 2006-10-27 13:55:24 Re: How to query information schema from shell script
Previous Message A. Kretschmer 2006-10-27 13:46:31 Re: How to query information schema from shell script