Re: catalog info for sequences
От | Julio Cesar Sánchez González |
---|---|
Тема | Re: catalog info for sequences |
Дата | |
Msg-id | 47B15B8E.2020004@sistemasyconectividad.com.mx обсуждение исходный текст |
Ответ на | catalog info for sequences (Marc Munro <marc@bloodnok.com>) |
Список | 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@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/
В списке pgsql-general по дате отправления: