catalog info for sequences
catalog info for sequences
От:
Marc Munro <marc@bloodnok.com>
Дата:
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
Re: catalog info for sequences
От:
Steve Atkins <steve@blighty.com>
Дата:
On Feb 11, 2008, at 11:39 AM, 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)? Take a look at information_schema.sequences for a list of sequence names, and "select * from sequence_name" for information about a specific sequence. Cheers, Steve
Re: catalog info for sequences
От:
Julio Cesar Sánchez González<knowhow@sistemasyconectividad.com.mx>
Дата:
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@postgresql.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/