In an old DOS database program I programmed in for years, there was a handy
function called
KEYEXISTS("value",index)
value of course was only in quotes if it was a string.
I'm imagining this could be pretty easily created as a function for
postgres, and I'm wondering if someone has already done this?
The recent discussion here on the Novice list sparked my memory of how very
often a KEYEXISTS type of function is useful. I know in my own work, an
attempt to insert a record where the primary key would be duplicated,
results in an error to the user, so I have to error trap and cannot "try to
insert and do something else if insert doesn't work" - I have to look for
the existence of a conflicting record and not insert if there is one.
Thank you,
- April