Re: calling currval() before nextval() patch adding

From: John Hansen <john(at)geeknet(dot)com(dot)au>
To: Rod Taylor <pg(at)rbt(dot)ca>
Cc: PostgreSQL Patches <pgsql-patches(at)postgresql(dot)org>
Subject: Re: calling currval() before nextval() patch adding
Date: 2004-11-08 00:10:23
Message-ID: 1099872623.16869.36.camel@localhost.localdomain
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-patches

> This might do what you're looking for on 8.0.
>
> CREATE OR REPLACE FUNCTION currval_isset(text) RETURNS bigint AS '
> DECLARE
> var integer;
> BEGIN
> SELECT currval($1) INTO var;
>
> RETURN var;
>
> EXCEPTION
> WHEN OBJECT_NOT_IN_PREREQUISITE_STATE THEN
> RETURN 0;
> END;
> ' LANGUAGE plpgsql;
>
> SELECT isset('tst_seq');
>

k, i don't actually have an 8.0 installation to play with here,. but
won't this still produce a warning?

In response to

Browse pgsql-patches by date

  From Date Subject
Next Message John Hansen 2004-11-08 00:26:07 Re: calling currval() before nextval() patch adding
Previous Message Tom Lane 2004-11-07 23:48:08 Re: calling currval() before nextval() patch adding currval_isset()