Index: openacs-4/packages/acs-subsite/sql/postgresql/acs-subsite-create.sql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/acs-subsite/sql/postgresql/acs-subsite-create.sql,v
diff -u -r1.1 -r1.2
--- openacs-4/packages/acs-subsite/sql/postgresql/acs-subsite-create.sql	12 Apr 2001 04:00:44 -0000	1.1
+++ openacs-4/packages/acs-subsite/sql/postgresql/acs-subsite-create.sql	17 Apr 2001 04:10:06 -0000	1.2
@@ -7,23 +7,41 @@
 -- @cvs-id $Id$
 --
 
-@@ attribute
-@@ portraits
-@@ application-groups-create
-@@ subsite-callbacks-create
+\i attribute.sql
+\i portraits.sql
+\i application-groups-create.sql
+\i user-profiles-create.sql
+\i subsite-callbacks-create.sql
 
 -- This view lets us avoid using acs_object.name to get party_names.
 -- 
-create or replace view party_names
+-- create or replace view party_names
+-- as
+-- select p.party_id,
+--        decode(groups.group_id,
+--               null, decode(persons.person_id, 
+--                            null, p.email,
+--                            persons.first_names || ' ' || persons.last_name),
+--               groups.group_name) as party_name
+-- from parties p,
+--      groups,
+--      persons
+-- where p.party_id = groups.group_id(+)
+--   and p.party_id = persons.person_id(+);
+
+create view party_names
 as
 select p.party_id,
-       decode(groups.group_id,
-              null, decode(persons.person_id, 
-                           null, p.email,
-                           persons.first_names || ' ' || persons.last_name),
-              groups.group_name) as party_name
-from parties p,
-     groups,
-     persons
-where p.party_id = groups.group_id(+)
-  and p.party_id = persons.person_id(+);
+       (case
+         when groups.group_id is null then
+	   (case
+	     when persons.person_id is null then
+	       p.email
+	     else
+	       persons.first_names || ' ' || persons.last_name
+	    end)
+         else
+	   groups.group_name	    
+       end) as party_name
+from ((parties p left outer join groups on p.party_id = groups.group_id)
+      left outer join persons on p.party_id = persons.person_id);
