Re: Generating sql to capture fully qualified table names???

Поиск
Список
Период
Сортировка
От Erik Jones
Тема Re: Generating sql to capture fully qualified table names???
Дата
Msg-id 920DB302-8105-4E52-BEE4-35679DAF9456@myemma.com
обсуждение исходный текст
Ответ на Generating sql to capture fully qualified table names???  (smiley2211 <smiley2211@yahoo.com>)
Список pgsql-general
On Oct 19, 2007, at 11:44 AM, smiley2211 wrote:

>
> Hello all,
>
> I am using the query below to generate SQL code to grant access to
> objects -
> how do I get this statement to PULL the fully qualified name
> (schema.tablename)???
>
> *****************
> SELECT 'GRANT SELECT, INSERT, UPDATE, DELETE ON '  || relname ||
>         ' TO newuser;'
>           FROM pg_class
>  where relname !~ 'pg_*' AND relkind in ('r','v','S') ORDER BY
> relname;
>
> *****************

SELECT 'GRANT ALL ON ' || n.nspname || '.' || c.relname ' TO newuser;'
FROM pg_class c, pg_namespace c
WHERE c.relnamespace=n.oid
    and n.nspname = 'your_schema_name';

Erik Jones

Software Developer | Emma®
erik@myemma.com
800.595.4401 or 615.292.5888
615.292.0777 (fax)

Emma helps organizations everywhere communicate & market in style.
Visit us online at http://www.myemma.com



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

Предыдущее
От: smiley2211
Дата:
Сообщение: Generating sql to capture fully qualified table names???
Следующее
От: "Joshua D. Drake"
Дата:
Сообщение: Re: Abbreviation list