Search Postgresql Archives

querying sequence names

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

 



I like to keep a "grants" script around that will fix all of the
permissions in my enviornments (I've got heavy development going on so
i'm frequently dropping and recreating an environment, or duplicating
the schema elsewhere)

finding a list of sequences that i could build dynamic sql off of was a
nightmare. I ended up creating a view based on the pg_tables view. 

CREATE OR REPLACE VIEW pg_sequences AS
 SELECT n.nspname AS schemaname, c.relname AS sequencename,
pg_get_userbyid(c.relowner) AS sequenceowner, t.spcname AS "tablespace",
c.relhasindex AS hasindexes, c.relhasrules AS hasrules, c.reltriggers >
0 AS hastriggers
   FROM pg_class c
   LEFT JOIN pg_namespace n ON n.oid = c.relnamespace
   LEFT JOIN pg_tablespace t ON t.oid = c.reltablespace
  WHERE c.relkind = 'S'::"char";

(basically changed 'r' to 'S')

so my question is - is there a better way to handle this?

Thanks!

Dave Kerr

-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

[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