B
B
BonBon Slick2018-02-10 18:38:34
PostgreSQL
BonBon Slick, 2018-02-10 18:38:34

Field in table unique and null?

I want to check the value for its uniqueness, while there are many entities in the table that have the value of the checked field null .
Can you please tell me what is in the box?
Doctrine, Symfony, PgSQL

Answer the question

In order to leave comments, you need to log in

1 answer(s)
0
0xD34F, 2018-02-10
@BonBonSlick

I mean, do you want non-null values ​​to be unique? Make a unique index:

CREATE UNIQUE INDEX table_name_column_name_not_null ON table_name(column_name)
WHERE column_name IS NOT NULL;

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question