diff --git a/application/Espo/Repositories/EmailAddress.php b/application/Espo/Repositories/EmailAddress.php
index <HASH>..<HASH> 100644
--- a/application/Espo/Repositories/EmailAddress.php
+++ b/application/Espo/Repositories/EmailAddress.php
@@ -288,7 +288,7 @@ class EmailAddress extends \Espo\Core\ORM\Repositories\RDB
                                 ".$pdo->quote($entity->id).",
                                 ".$pdo->quote($entity->getEntityName()).",
                                 ".$pdo->quote($emailAddress->id).",
-                                ".$pdo->quote($address === $primary)."
+                                ".$pdo->quote((int)($address === $primary))."
                             )
                     ";
                     $sth = $pdo->prepare($query);
fix email address primary pdo quote