querying sequence names

Поиск
Список
Период
Сортировка
От David Kerr
Тема querying sequence names
Дата
Msg-id 20090414201656.GC13876@mr-paradox.net
обсуждение исходный текст
Список 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 по дате отправления:

Предыдущее
От: benoît carpentier
Дата:
Сообщение: Benetl, a free ETL tool for files using postgreSQL, is out in version 2.7
Следующее
От: Kynn Jones
Дата:
Сообщение: Re: 'no pg_hba.conf entry for host "[local]", user "postgres", database "postgres"'...