Index: openacs-4/packages/acs-kernel/sql/postgresql/community-core-create.sql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/acs-kernel/sql/postgresql/community-core-create.sql,v
diff -u -r1.29.6.2 -r1.29.6.3
--- openacs-4/packages/acs-kernel/sql/postgresql/community-core-create.sql	23 Feb 2019 13:03:40 -0000	1.29.6.2
+++ openacs-4/packages/acs-kernel/sql/postgresql/community-core-create.sql	4 Apr 2019 11:01:53 -0000	1.29.6.3
@@ -806,14 +806,13 @@
 DECLARE
     v_user_id                  users.user_id%TYPE;
     v_authority_id             auth_authorities.authority_id%TYPE;
-    v_person_exists            varchar;			
+    v_person_exists            integer;			
 BEGIN
     v_user_id := p_user_id;
 
-    select case when count(*) = 0 then 'f' else 't' end into v_person_exists
-    from persons where person_id = v_user_id;
+    select 1 from persons into v_person_exists where person_id = v_user_id;
 
-    if v_person_exists = 'f' then
+    if NOT FOUND then
         v_user_id := person__new(
             v_user_id, 
             p_object_type,
@@ -905,15 +904,15 @@
    receives_alerts_p__user_id integer
 ) RETURNS boolean AS $$
 DECLARE
-  counter                                   boolean;       
+  found_p boolean;       
 BEGIN
-  select case when count(*) = 0 then 'f' else 't' end into counter
-   from users
-   where no_alerts_until >= now()
-   and user_id = receives_alerts_p__user_id;
+  select exists into found_p (
+        select 1 from users
+        where no_alerts_until >= now()
+        and user_id = receives_alerts_p__user_id
+  );
 
-  return counter;
-  
+  return found_p;
 END;
 $$ LANGUAGE plpgsql stable;
 
