The particular postgres database table has 21 fields one of which is set for sequence as a primary key "repair_id". The other unique field called "repair_accession" is also a special unique TEXT in a format like "NH13-1".
I am looking for a reliable trigger function for generating unique number based on two letters, two digit year format, and an auto-increment number that resets to 1 annually on Jan 1st.
Example: for 2013 = NH13-1 up-to NH13-999999
and on January 1st 2014, it will reset itself and starts as NH14-1 up to NH14-999999
etc.
Your answer is much apprecaited!!