By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
464,781 Members | 1,284 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 464,781 IT Pros & Developers. It's quick & easy.

Sequence Meta Data from System Catalogs?

P: n/a
Hi,

I am trying to get the meta data of a sequence that I created out from
the system catalogs, so that I can reconstruct the SQL Statement. I
need this for pre and post PG 7.3 ... or either. I have read through
the documentation and the past postings and can't seem to find any
reference to the topic.

I currently can execute this statement to create the Sequence ...

CREATE SEQUENCE FULL_SEQUENCE
INCREMENT 2
MINVALUE 1
MAXVALUE 20000
START 7 CACHE 5 CYCLE

Then, execute this statement to get a name list of the existing
sequence ...

SELECT *
FROM PG_CLASS
WHERE RELKIND = 'S'
AND UPPER(RELNAME) = 'FULL_SEQUENCE'

But, the only data that the pg_class table provides is the name of the
Sequence. It doesn't provide me with the INCREMENT, MINVALUE,
MAXVALUE, START, CACHE or CYCLE values. From the documentation there
doesn't seem to be any 'related' foreign tables that have any extra
data.

Is this information in the System Tables?
thanks
-John
Jul 19 '05 #1
Share this Question
Share on Google+
1 Reply

P: n/a
Jo****@aquafold.com (JohnLH) wrote in message news:<bc**************************@posting.google. com>...
Hi,

I am trying to get the meta data of a sequence that I created out from
the system catalogs, so that I can reconstruct the SQL Statement. I
need this for pre and post PG 7.3 ... or either. I have read through
the documentation and the past postings and can't seem to find any
reference to the topic.

I currently can execute this statement to create the Sequence ...

CREATE SEQUENCE FULL_SEQUENCE
INCREMENT 2
MINVALUE 1
MAXVALUE 20000
START 7 CACHE 5 CYCLE

Then, execute this statement to get a name list of the existing
sequence ...

SELECT *
FROM PG_CLASS
WHERE RELKIND = 'S'
AND UPPER(RELNAME) = 'FULL_SEQUENCE'

But, the only data that the pg_class table provides is the name of the
Sequence. It doesn't provide me with the INCREMENT, MINVALUE,
MAXVALUE, START, CACHE or CYCLE values. From the documentation there
doesn't seem to be any 'related' foreign tables that have any extra
data.

Is this information in the System Tables?
thanks
-John


Simple. A sequence is implemented as a table with the same name. So
all you need to do is:

select * from FULL_SEQUENCE;
Jul 19 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.