I have a web application that store some data in postgresql db, I need the server (postgresql) to add a value in the record based on the value from web application.
Return the highest value for that particular group and Insert highest value +1 in a new record together with the information that comes from web.
I think this could be solved with stored procedure/insert trigger.
This is an easy task for a skilled DBA.
Hi,
This indeed seems straightforward. I would create an insert trigger and related trigger function to do the job.
Is this only for insert operations or update also?
What is your postgresql version?
Does this job involve and non-postrgresql work? My bid involves only the pg programming.
Do you have multiple rows in one insert?
Do you have a **lot** of inserts going on in your table, in other words are there any performance considerations? This case there should be a better way to find out the next value of a kind-of serial field then selecting the highest from existing table. Maybe a sequence for every one of your groups...