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

From: Osvaldo Rosario Kussama <osvaldo_kussama(at)yahoo(dot)com(dot)br>
To: smiley2211 <smiley2211(at)yahoo(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Generating sql to capture fully qualified table names???
Date: 2007-10-19 17:23:34
Message-ID: 4718E816.3010504@yahoo.com.br
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

smiley2211 escreveu:
> 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 SELECT, INSERT, UPDATE, DELETE ON ' ||
pn.nspname || '.' || pc.relname ||' TO newuser;'
FROM pg_class pc JOIN pg_namespace pn
ON (pc.relnamespace = pn.oid)
WHERE pc.relname !~ 'pg_*' AND relkind in ('r','v','S')
AND pn.nspname != 'information_schema'
ORDER BY relname;

Osvaldo

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Alvaro Herrera 2007-10-19 17:28:30 Re: Abbreviation list
Previous Message Joshua D. Drake 2007-10-19 17:19:39 Re: Abbreviation list