Re: Foreign key error, please help.

From: Bruno Wolff III <bruno(at)wolff(dot)to>
To: Kumar S <ps_postgres(at)yahoo(dot)com>
Cc: Stephan Szabo <sszabo(at)megazone(dot)bigpanda(dot)com>, pgsql-novice(at)postgresql(dot)org
Subject: Re: Foreign key error, please help.
Date: 2005-03-09 15:21:00
Message-ID: 20050309152100.GB7213@wolff.to
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

On Wed, Mar 09, 2005 at 06:46:45 -0800,
Kumar S <ps_postgres(at)yahoo(dot)com> wrote:
> Hi Stephan,
> Thank you very much, it was my stupid mistake.
>
> One more question. aplogies if this is also not so
> worthy question.
> In a transaction does currval work only if a previous
> statement defines it. In my case I wanted to get FK
> from existing currval in sample table (sample_id).
> when I execute my statements in a transasction, I get
> the following error. Do I have to just use a SELECT
> statement here, because currval is not working? Or did
> i made a mistake instead?

If you haven't used nextval in the current session, currval doesn't have
a value yet, so you can't use it. Which value would you expect it to use?

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message Tom Lane 2005-03-09 15:25:25 Re: When are trigger function results committed
Previous Message Keith Worthington 2005-03-09 15:20:30 When are trigger function results committed