Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 6bb6fb5

Browse files
authored
AND NEW.email !~ '^\s*$'
1 parent 96bcfcd commit 6bb6fb5

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

‎README.md‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -231,15 +231,18 @@ DROP TRIGGER IF EXISTS person_email_check_insert ON person_email;
231231
CREATE TRIGGER person_email_check_insert
232232
BEFORE INSERT ON person
233233
FOR EACH ROW
234-
WHEN (NEW.email IS NOT NULL)
234+
WHEN (NEW.email IS NOT NULL
235+
AND NEW.email !~ '^\s*$')
235236
EXECUTE PROCEDURE person_email_check();
236237

237238
--обновление
238239
DROP TRIGGER IF EXISTS person_email_check_update ON person_email;
239240
CREATE TRIGGER person_email_check_update
240241
BEFORE UPDATE OF email ON person -- поле явно указано в UPDATE запросе!
241242
FOR EACH ROW
242-
WHEN (NEW.email IS NOT NULL AND NEW.email IS DISTINCT FROM OLD.email) -- значение изменилось
243+
WHEN (NEW.email IS NOT NULL
244+
AND NEW.email !~ '^\s*$'
245+
AND NEW.email IS DISTINCT FROM OLD.email) -- значение изменилось
243246
EXECUTE PROCEDURE person_email_check();
244247
```
245248

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /