Re: Sequences - Mailing list pgsql-general

From Tom Lane
Subject Re: Sequences
Date
Msg-id 9318.1063945285@sss.pgh.pa.us
Whole thread Raw
In response to Sequences  (Andrew Rawnsley <ronz@ravensfield.com>)
List pgsql-general
Andrew Rawnsley <ronz@ravensfield.com> writes:
> Sequence information is stored in their individual 1-row tables, with
> an entry is pg_class of relkind 'S'. So you can't
> really get a list of sequences with last_value in a single query

Nope, you can't ... and I surely hope you weren't expecting that the
last_values would all be simultaneously valid ...

What I'd try for this is

select relname, get_last_value(relname) from pg_class where relkind = 'S';

where get_last_value() is a plpgsql function that does an EXECUTE.
But you must realize that there will be time skew between the
last_values.

What is the problem you really want to solve?

            regards, tom lane

pgsql-general by date:

Previous
From: expect
Date:
Subject: This mail list and its policies
Next
From: Tom Lane
Date:
Subject: Re: This mail list and its policies