create_tables.pgsql
changeset 13 1d9bf63a86f7
parent 9 e3d3dbeb5b84
child 15 1607f7b2dba9
equal deleted inserted replaced
12:44161dbb1518 13:1d9bf63a86f7
    88       FROM users
    88       FROM users
    89            LEFT JOIN domains USING (gid);
    89            LEFT JOIN domains USING (gid);
    90 
    90 
    91 CREATE OR REPLACE VIEW dovecot_user AS
    91 CREATE OR REPLACE VIEW dovecot_user AS
    92     SELECT local_part || '@' || domains.domainname AS userid,
    92     SELECT local_part || '@' || domains.domainname AS userid,
    93            domains.domaindir || '/' || uid AS home,
    93            domains.domaindir || '/' || uid AS home, uid, gid
    94            uid,
       
    95            gid
       
    96       FROM users
    94       FROM users
    97            LEFT JOIN domains USING (gid);
    95            LEFT JOIN domains USING (gid);
    98 
    96 
    99 CREATE OR REPLACE VIEW postfix_gid AS
    97 CREATE OR REPLACE VIEW postfix_gid AS
   100     SELECT gid, domainname
    98     SELECT gid, domainname
   101       FROM domains;
    99       FROM domains;
   102 
   100 
   103 CREATE OR REPLACE VIEW postfix_uid AS
   101 CREATE OR REPLACE VIEW postfix_uid AS
   104     SELECT local_part || '@' || domains.domainname AS address,
   102     SELECT local_part || '@' || domains.domainname AS address, uid
   105            uid
       
   106       FROM users
   103       FROM users
   107            LEFT JOIN domains USING (gid);
   104            LEFT JOIN domains USING (gid);
   108 
   105 
   109 CREATE OR REPLACE VIEW postfix_maildir AS
   106 CREATE OR REPLACE VIEW postfix_maildir AS
   110     SELECT local_part || '@' || domains.domainname AS address,
   107     SELECT local_part || '@' || domains.domainname AS address,