Re: Sequences

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Andrew Rawnsley <ronz(at)ravensfield(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Sequences
Date: 2003-09-19 04:21:25
Message-ID: 9318.1063945285@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Andrew Rawnsley <ronz(at)ravensfield(dot)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

In response to

  • Sequences at 2003-09-19 03:35:08 from Andrew Rawnsley

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2003-09-19 04:25:42 Re: This mail list and its policies
Previous Message expect 2003-09-19 03:59:53 This mail list and its policies