Hi,
I am writing an Application (Java) which uses one table with a pk and a bytea.
The pk I get from a sequenc called incpkphoto. Now my problem is, that I need to get the nextval, before I use it to save to the table. I have to tell the user, which pk was used.

The statement
SELECT nextval('incpkphoto') as incpkphoto_pk FROM incpkphoto;
works somehow, but there seems to be something wrong. (I need to save the nextval to incpkphoto_pk because that is, as far as I know, the only way to get then the value).

For those of you who might know their way with java, please have also a look at my code:

long pk = -1;
System.out.println("test1");
Statement s = c.createStatement();
ResultSet rs = s.executeQuery("SELECT nextval('incpkphoto') as incpkphoto_pk FROM incpkphoto;");
System.out.println("test2");
pk = rs.getLong("incpkphoto_pk");
System.out.println("nextval returned" + pk);
rs.close();
s.close();

If you know anything that might help me, I would really appreciate it.
Thanks in advance