Results 1 to 2 of 2
  1. #1
    Johnlh Guest

    Answered: 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

  2. Best Answer
    Posted by Adam Ruth

    "JohnLH@aquafold.com (JohnLH) wrote in message news:<bca69489.0309260005.4f245619@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;
    "


  3. #2
    Adam Ruth Guest

    Re: Sequence Meta Data from System Catalogs?

    JohnLH@aquafold.com (JohnLH) wrote in message news:<bca69489.0309260005.4f245619@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;

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •