Hey all --

I have a column in a postgres table, called photo_id. I can tell it exists because if I do a "describe table", I see the following:

Table "images"
Column | Type | Modifiers
----------------+-----------------------+---------------------------------------------
photo_id | integer | not null default nextval('photo_seq'::text)
length | integer | not null
satmean | integer | not null
intensitymean | integer | not null
subtopic | character varying(60) |
keyworda | character varying(60) |
keywordb | character varying(60) |
keywordc | character varying(60) |
clientname | character varying(60) |
designyear | date |
filename | character varying(60) |
primarycolor | character varying(60) |
secondarycolor | character varying(60) |
file | bytea |
topic | character varying(60) |

However, when my servlet calls:

select max( photo_id ) from images

it gets this error:

SQL EXCEPTION!: The column name photo_id not found.
SQL EXCEPTION!: null
SQL EXCEPTION!: 0

The weird thing is, that same " select max" statement works just fine when typed into the command-line client. Any idea what I'm doing wrong? Or more to the point, know of any other way I can select that last id inserted?

Thanks so much -- Matt