Search Postgresql Archives

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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




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@xxxxxxxxxx
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



---------------------------(end of broadcast)---------------------------
TIP 4: Have you searched our list archives?

              http://archives.postgresql.org/


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux