On 8/16/06, Dawid Kuroczko <qnex42(at)gmail(dot)com> wrote:
> -- then create a function to retrieve the values:
> CREATE FUNCTION gseq_nextval(t text) RETURNS integer AS $$
> DECLARE
> n integer;
> BEGIN
> SELECT INTO n gseq_value+1 FROM gapless_seq WHERE gseq_name = t
> FOR UPDATE;
> UPDATE gapless_seq SET gapless_value = n WHERE gseq_name = t;
> RETURN n;
> END;
> $$ STABLE LANGUAGE PLpgsql;
^^^^^^^^^^^
VOLATILE of course!
Regards,
Dawid