Re: How to query information schema from shell script - Mailing list pgsql-sql

From George Pavlov
Subject Re: How to query information schema from shell script
Date
Msg-id 8C5B026B51B6854CBE88121DBF097A8655C56E@ehost010-33.exch010.intermedia.net
Whole thread Raw
In response to How to query information schema from shell script  ("Jon Horsman" <horshaq@gmail.com>)
List 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


pgsql-sql by date:

Previous
From: "Jon Horsman"
Date:
Subject: How to query information schema from shell script
Next
From: "A. Kretschmer"
Date:
Subject: Re: How to query information schema from shell script