SQL Not Empty instead of Not NULL

后端 未结 2 2056
孤街浪徒
孤街浪徒 2021-02-07 08:01

I am using postgreSQL. I have a column that:

NOT NULL

However when I want to insert a row with an empty string as like:

\'\'
         


        
2条回答
  •  挽巷
    挽巷 (楼主)
    2021-02-07 08:21

    Add a constraint to column definition. For example something like:

    ads character varying(60) NOT NULL CHECK (ads <> '')
    

    For more, see http://www.postgresql.org/docs/current/static/ddl-constraints.html

提交回复
热议问题