querying sequence names - Mailing list pgsql-general

From David Kerr
Subject querying sequence names
Date
Msg-id 20090414201656.GC13876@mr-paradox.net
Whole thread Raw
List pgsql-general
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

pgsql-general by date:

Previous
From: benoît carpentier
Date:
Subject: Benetl, a free ETL tool for files using postgreSQL, is out in version 2.7
Next
From: Kynn Jones
Date:
Subject: Re: 'no pg_hba.conf entry for host "[local]", user "postgres", database "postgres"'...