From: | Julio Cesar Sánchez González <knowhow(at)sistemasyconectividad(dot)com(dot)mx> |
---|---|
To: | Marc Munro <marc(at)bloodnok(dot)com> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: catalog info for sequences |
Date: | 2008-02-12 08:40:46 |
Message-ID: | 47B15B8E.2020004@sistemasyconectividad.com.mx |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Marc Munro wrote:
> Can someone please tell me how to extract the mix, max, increment by,
> etc, values for a sequence from the system catalogs. Is this in the
> manual somewhere (I couldn't find it)?
>
> Thanks
>
> __
> Marc
>
> ---------------------------(end of broadcast)---------------------------
> TIP 1: if posting/reading through Usenet, please send an appropriate
> subscribe-nomail command to majordomo(at)postgresql(dot)org so that your
> message can get through to the mailing list cleanly
>
try with select * from your_sequence_name;
or try next plpgsql function:
CREATE OR REPLACE FUNCTION obtenersecuencias() RETURNS void AS $$
DECLARE
sec_names RECORD;
row RECORD;
secuencia refcursor;
BEGIN
FOR sec_names IN select relname from pg_class where relkind = 'S' LOOP
OPEN secuencia FOR EXECUTE 'SELECT * FROM ' || sec_names.relname;
FETCH secuencia INTO row;
CLOSE secuencia;
RAISE NOTICE 'secuencia = %, last_val = %',row.sequence_name,
row.last_value;
END LOOP;
END;
$$ LANGUAGE plpgsql;
--
Regards,
Julio Cesar Sánchez González.
--
Ahora me he convertido en la muerte, destructora de mundos.
Soy la Muerte que se lleva todo, la fuente de las cosas que vendran.
www.sistemasyconectividad.com.mx http://darkavngr.blogspot.com/
From | Date | Subject | |
---|---|---|---|
Next Message | Ivan Sergio Borgonovo | 2008-02-12 08:44:30 | Re: end of life for pg versions... |
Previous Message | Richard Huxton | 2008-02-12 08:19:01 | Re: WINDOWS INSTALLATION TIPS |