Answer the question
In order to leave comments, you need to log in
Why is the limit not working?
you need to set a limit on the field so that it can take only those values \u200b\u200bthat would begin with a Russian letter
, so I create
ALTER TABLE abonents
ADD CONSTRAINT last_name_check
CHECK (last_name LIKE '[А-я]%') NOT VALID;
Answer the question
In order to leave comments, you need to log in
They wrote that last_name should start with the string [А-з] - this is how it is checked.
melkij=> select '[A]ds' like '[A]%';
?column?
----------
t
(1 line)
Colleagues, the person simply confused the syntax for SIMILAR TO expressions and for LIKE expressions.
correct syntax
ALTER TABLE abonents
ADD CONSTRAINT last_name_check
CHECK (last_name SIMILAR TO '[А-я]%');
ALTER TABLE abonents
ADD CONSTRAINT last_name_check
CHECK (last_name ~ '[А-я].*');
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question