You can write the function in pgPerl, then use it in your constraint.
As the Lund function only uses data from the record in question, there should be no problem if it's used there. a db purist might argue that, as the validation of the number is a business rule, it should be used within a rule or trigger, instead of in a column constraint, though.
Last edited by loquin; 08-27-14 at 12:24.
"Lisa, in this house, we obey the laws of thermodynamics!" - Homer Simpson
"I have my standards. They may be low, but I have them!" - Bette Middler
"It's a book about a Spanish guy named Manual. You should read it." - Dilbert