Re: Test to see if currval will fail? - Mailing list pgsql-novice

From Josh Berkus
Subject Re: Test to see if currval will fail?
Date
Msg-id web-2023196@davinci.ethosmedia.com
Whole thread Raw
In response to Test to see if currval will fail?  (Kelly McDonald <w4kpm@adelphia.net>)
Responses Re: Test to see if currval will fail?
List pgsql-novice
Kelly,

> Is there a test to see if a call to currval will fail? I would like
> to
> call nextval one time per session inside a trigger. I am working on
> other solutions, but I searched the docs and didn't find what I was
> looking for.

You could do "select last_value from <sequence name>" instead.
 However, I'm not sure that that method of getting the currval is
session-protected in the way that currval is.

-Josh Berkus

pgsql-novice by date:

Previous
From: "Josh Berkus"
Date:
Subject: Re: Infinite Loop
Next
From: "Mark Wilson"
Date:
Subject: Re: Infinite Loop