Index: openacs-4/packages/acs-kernel/sql/postgresql/acs-create.sql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/acs-kernel/sql/postgresql/acs-create.sql,v
diff -u -r1.27 -r1.27.2.1
--- openacs-4/packages/acs-kernel/sql/postgresql/acs-create.sql	4 Mar 2004 14:52:41 -0000	1.27
+++ openacs-4/packages/acs-kernel/sql/postgresql/acs-create.sql	20 Sep 2004 20:08:16 -0000	1.27.2.1
@@ -13,8 +13,6 @@
                         references acs_objects(object_id)
 );
 
-create index acs_mo_object_id_idx on acs_magic_objects (object_id);
-
 comment on table acs_magic_objects is '
  This table allows us to provide semantic names for certain special
  objects like the site-wide organization, and the all users party.
@@ -129,15 +127,10 @@
 returns integer as '
 declare
   magic_object_id__name                   alias for $1;  
-  magic_object_id__object_id              acs_objects.object_id%TYPE;
 begin
-    select object_id
-    into magic_object_id__object_id
+    return object_id
     from acs_magic_objects
     where name = magic_object_id__name;
-
-    return magic_object_id__object_id;
-   
 end;' language 'plpgsql' immutable strict;
 
 -- ******************************************************************
@@ -147,13 +140,12 @@
 create view registered_users
 as
   select p.email, p.url, pe.first_names, pe.last_name, u.*, mr.member_state
-  from parties p, persons pe, users u, group_member_map m, membership_rels mr, acs_magic_objects amo
+  from parties p, persons pe, users u, group_member_map m, membership_rels mr
   where party_id = person_id
   and person_id = user_id
   and u.user_id = m.member_id
   and m.rel_id = mr.rel_id
-  and amo.name = 'registered_users'
-  and m.group_id = amo.object_id
+  and m.group_id = acs__magic_object_id('registered_users')
   and m.container_id = m.group_id
   and m.rel_type = 'membership_rel'
   and mr.member_state = 'approved'
@@ -172,13 +164,12 @@
 create view cc_users
 as
 select o.*, pa.*, pe.*, u.*, mr.member_state, mr.rel_id
-from acs_objects o, parties pa, persons pe, users u, group_member_map m, membership_rels mr, acs_magic_objects amo
+from acs_objects o, parties pa, persons pe, users u, group_member_map m, membership_rels mr
 where o.object_id = pa.party_id
   and pa.party_id = pe.person_id
   and pe.person_id = u.user_id
   and u.user_id = m.member_id
-  and amo.name = 'registered_users'
-  and m.group_id = amo.object_id
+  and m.group_id = acs__magic_object_id('registered_users')
   and m.rel_id = mr.rel_id
   and m.container_id = m.group_id
   and m.rel_type = 'membership_rel';
@@ -381,7 +372,6 @@
   ('default_context', -3);
 
 
-
 --------------------------------------------------------
 --
 -- Authentication object
