Hm, good point.  We could put 'em in pg_sequence, except that most of
the operations on pg_sequence rows will be nontransactional, and that
doesn't seem to square nicely with transactional updates on ACLs.
Maybe we need two catalogs just to separate the transactional and
nontransactional data for a sequence?  Ugh.

Is it possible to have an SRF that can peek into the lastval data and present it, and make no changes to our catalogs at all?

Or can't we use in the schema view something like:

CREATE VIEW sequences AS
  SELECT CAST(current_database() AS sql_identifier) AS sequence_catalog,
         CAST(nc.nspname AS sql_identifier) AS sequence_schema,
         CAST(c.relname AS sql_identifier) AS sequence_name,
         (SELECT seq_info('sequence_name', 'max')) AS maximum_value,
         (SELECT seq_info('sequence_name', 'min')) AS minimum_value,
         (SELECT seq_info('sequence_name', 'inc')) AS increment,
         (SELECT seq_info('sequence_name', 'cycle')) AS cycle_option
  FROM pg_namespace nc, pg_class c
  WHERE c.relnamespace = nc.oid
        AND c.relkind = 's';

Chris


---------------------------(end of broadcast)---------------------------
TIP 6: explain analyze is your friend

Reply via email to