grant select script

Поиск
Список
Период
Сортировка
От Marc Fromm
Тема grant select script
Дата
Msg-id 93361C67E4EE844A80935863A4FF4B6C04E613C3@Exch2010MB-2.univ.dir.wwu.edu
обсуждение исходный текст
Ответы Re: grant select script  ("Kevin Grittner" <Kevin.Grittner@wicourts.gov>)
Re: grant select script  (Bob Lunney <bob_lunney@yahoo.com>)
Список pgsql-admin

I am working with a script to automate grant select to all tables in a database to a user.

  1 #!/bin/bash

  2 for table in 'echo "SELECT relname FROM pg_stat_all_tables;" | psql cswe2 | grep -v "pg_" | grep "^ "';

  3 do

  4 echo "GRANT SELECT ON TABLE $table to tom;"

  5 echo "GRANT SELECT ON TABLE $table to tom;" | psql cswe2

  6 done

 

The script works—meaning it grants the select to the user, but it generates errors on tables that do not exist like the following.

The data base cswe2 does not contain the table sql_languages, unless it is hidden. Is there a way to tell the script to ignore them?

GRANT SELECT ON TABLE sql_languages to tom;

ERROR:  relation "sql_languages" does not exist

 

Thanks

 

Marc

 

 

Marc Fromm
Information Technology Specialist II
Financial Aid Department
Western Washington University
Phone: 360-650-3351
Fax:   360-788-0251

В списке pgsql-admin по дате отправления:

Предыдущее
От: David Bear
Дата:
Сообщение: Re: odbc
Следующее
От: "Kevin Grittner"
Дата:
Сообщение: Re: grant select script