470,581 Members | 2,427 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,581 developers. It's quick & easy.

Sequence Meta Data from System Catalogs?

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
1 2979
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.

Similar topics

5 posts views Thread by Donald Firesmith | last post: by
30 posts views Thread by Anon | last post: by
2 posts views Thread by DB2 Convert | last post: by
3 posts views Thread by PJ6 | last post: by
1 post views Thread by elein | last post: by
reply views Thread by rval | last post: by
7 posts views Thread by aj | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.