pgsql/create_tables-dovecot-1.2.x.pgsql
branchv0.6.x
changeset 388 dd95ed5bc9d2
parent 387 05dc4e1f8dff
child 391 8217ddd5220d
equal deleted inserted replaced
387:05dc4e1f8dff 388:dd95ed5bc9d2
   201               FROM relocated
   201               FROM relocated
   202              WHERE relocated.gid = domain_data.gid) AS relocated,
   202              WHERE relocated.gid = domain_data.gid) AS relocated,
   203            (SELECT count(gid)
   203            (SELECT count(gid)
   204               FROM domain_name
   204               FROM domain_name
   205              WHERE domain_name.gid = domain_data.gid
   205              WHERE domain_name.gid = domain_data.gid
   206                AND NOT domain_name.is_primary) AS aliasdomains
   206                AND NOT domain_name.is_primary) AS aliasdomains,
       
   207            bytes, messages
   207       FROM domain_data
   208       FROM domain_data
   208            LEFT JOIN domain_name USING (gid)
   209            LEFT JOIN domain_name USING (gid)
       
   210            LEFT JOIN quotalimit USING (qid)
   209            LEFT JOIN transport USING (tid)
   211            LEFT JOIN transport USING (tid)
   210            LEFT JOIN users USING (gid)
   212            LEFT JOIN users USING (gid)
   211      WHERE domain_name.is_primary
   213      WHERE domain_name.is_primary
   212   GROUP BY gid, domainname, transport, domaindir;
   214   GROUP BY gid, domainname, transport, domaindir, bytes, messages;
   213 
   215 
   214 
   216 
   215 CREATE LANGUAGE plpgsql;
   217 CREATE LANGUAGE plpgsql;
   216 
   218 
   217 
   219