From: Bruno Wolff III <bruno@wolff.to>
To: Matthew Horoschun <mhoroschun@canprint.com.au>
Cc: pgsql-sql@postgresql.org
Subject: Re: Knowing when it is safe to call currval()
Date: Sat, 10 May 2003 23:41:04 -0500
Message-ID: <20030511044104.GA20184@wolff.to> (raw)
In-Reply-To: <9377CBC6-8366-11D7-B0B7-000393B3A702@canprint.com.au>
References: <9377CBC6-8366-11D7-B0B7-000393B3A702@canprint.com.au>
On Sun, May 11, 2003 at 14:11:01 +1000,
Matthew Horoschun <mhoroschun@canprint.com.au> wrote:
> Hi All,
>
> Is there any way to know ahead of time whether calling currval() on a
> sequence will cause an exception like:
>
> ERROR: some_id_seq.currval is not yet defined in this session
>
> In my function I can't be sure whether nextval() will have previously
> been called in the session.
Well you could just call nextval at the start of the session to make sure
it has a value.
Howvere it is odd that you would want to call currval when there may not
have already been a call to nextval. What are you doing with the returned
value?
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: bruno@wolff.to, mhoroschun@canprint.com.au
Subject: Re: Knowing when it is safe to call currval()
In-Reply-To: <20030511044104.GA20184@wolff.to>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox