Triggers are generally more robust. Quick example:
NEW.noteid := SELECT 1+ COALESCE( (SELECT noteid FROM "Notes" WHERE userkey=NEW.userkey ORDER BY noteid DESC LIMIT 1), 0 );
Can you please write me the whole trigger? I've been reading the manual for an hour and I have no idea in where to apply this code.
Applications must take care of race conditions (like 2 clients trying to insert same noteid).
Doesn't the multiple primary key key fix this problem?
--
Human beings make life so interesting.
Do you know that in a universe so full of wonder,
they have managed to invent boredom? Quite astonishing.