--- 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
> 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
> the following error. Do I have to just use a SELECT
> statement here, because currval is not working? Or
> i made a mistake instead?
> Thank you.
curval reports the most recent value of nextval
(serial datatype). nextval automatically occurs on an
insert. therefore, when you do an insert, you don't
need to specifically call nextval, it has already been
done by postgres.
yes, you need to SELECT the fk from the row in
question if you have not done and insert or if nextval
was never called.
Celebrate Yahoo!'s 10th Birthday!
Yahoo! Netrospective: 100 Moments of the Web
pgsql-novice by date
|Next:||From: John DeSoi||Date: 2005-03-09 18:39:05|
|Subject: Re: VERY basic psql and schema question|
|Previous:||From: Sean||Date: 2005-03-09 17:53:25|
|Subject: Exporting Tables|