Re: How to query information schema from shell script

Поиск
Список
Период
Сортировка
От George Pavlov
Тема Re: How to query information schema from shell script
Дата
Msg-id 8C5B026B51B6854CBE88121DBF097A8655C56E@ehost010-33.exch010.intermedia.net
обсуждение исходный текст
Ответ на How to query information schema from shell script  ("Jon Horsman" <horshaq@gmail.com>)
Список 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 по дате отправления:

Предыдущее
От: "Jon Horsman"
Дата:
Сообщение: How to query information schema from shell script
Следующее
От: "A. Kretschmer"
Дата:
Сообщение: Re: How to query information schema from shell script