no results for nextval() query?

From: Steve Lefevre <lefevre(dot)10(at)osu(dot)edu>
To: pgsql-novice(at)postgresql(dot)org
Subject: no results for nextval() query?
Date: 2007-06-12 22:49:37
Message-ID: 466F2301.6010309@osu.edu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

Hello all -

I'm having problems with a primary key column that has a sequence. I'm
trying to reserve a value using nextval ( I've also tried currval() ),
but my query returns no results. I was originally confused because I was
doing "SELECT nextval(column_name) FROM table" instead of "SELECT
nextval(sequence_name) FROM table". Then, I had the sequence name wrong,
so I got a "does not exist" error. However, now that I have the name
right -- and I think it's right because I don't get an error -- I get an
empty result set. What am I doing wrong? The sequence seems to be
working, because the primary key field defaults to the next value in the
sequence when I do an insert.

Steve Lefevre

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Steve Lefevre 2007-06-12 22:59:43 Joins within a table
Previous Message Andrew 2007-06-12 14:55:00 Recovering Postgres databases