On Mon, May 02, 2005 at 05:30:12PM +0100, Sam Adams wrote: > > I'm having trouble getting the currval function to work from a Java > program (or from Postgres at all). I want to get the value of addressid > in the table taddress. The best I seem to be able to come up with is > 'SELECT currval(taddress.addressid)'.
The argument to currval() is a quoted sequence name, so you probably need something like this: SELECT currval('taddress_addressid_seq'); In PostgreSQL 8.0 you can use pg_get_serial_sequence() to get the sequence name from the table and column names: SELECT currval(pg_get_serial_sequence('taddress', 'addressid')); -- Michael Fuhr http://www.fuhr.org/~mfuhr/ ---------------------------(end of broadcast)--------------------------- TIP 4: Don't 'kill -9' the postmaster