Postgres Function to Validate Email Address

前端 未结 6 2113
伪装坚强ぢ
伪装坚强ぢ 2021-01-02 09:30

A check constraint which would call a function to validate email addresses is not working fine for me.

CREATE OR REPLACE FUNCTION f_IsValidEmail(text) return         


        
6条回答
  •  孤独总比滥情好
    2021-01-02 10:13

    Before you go putting a lot of effort into this, the thing you want to do is make sure you're not kicking out valid email addresses. There's all kinds of insane rules for can or can't be in an email address, and if you get it wrong, in the wrong direction, a user with a perfectly valid email address might get rejected by your system.

    The best way to determine if an email address is valid is to use it as part of a registration process where email is REQUIRED. Anything else is a lot of work for little gain.

提交回复
热议问题