Re: Accessing schema data in information schema - Mailing list pgsql-hackers

From Christopher Kings-Lynne
Subject Re: Accessing schema data in information schema
Date
Msg-id 4422235A.9050404@calorieking.com
Whole thread Raw
In response to Re: Accessing schema data in information schema  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
> 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.nspnameAS 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



pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Accessing schema data in information schema
Next
From: Tom Lane
Date:
Subject: Re: create type error message