|
1 | 1 | -- |
2 | 2 | -- Notes: |
3 | 3 | -- |
4 | | --- * if you're running RHEL/CentOS 6 or 7, don't forget to uncomment lines |
5 | | --- under `Required by RHEL/CentOS X` to create dblink function. |
| 4 | +-- * Don't forget to uncomment lines under `Required by PostgreSQL x` to |
| 5 | +-- create dblink function, If you're running PostgreSQL 8.x, you can find |
| 6 | +-- `dblink.sql` in package 'postgresql-contrib'. |
6 | 7 | -- |
7 | 8 | -- * of course you should replace `xxx` in below sample SQL command by the |
8 | 9 | -- real SQL username/password/database name. |
9 | 10 | -- |
10 | | --- * it's better to use SQL user `vmail` which has read-only permission to |
11 | | --- `vmail` database. Don't use `vmailadmin` or `postgres` user. |
| 11 | +-- * it's better to use a SQL user who has read-only permission on the |
| 12 | +-- source database. On iRedMail server, please use `vmail` user, do NOT |
| 13 | +-- use `vmailadmin` or `postgres` user. |
12 | 14 |
|
13 | 15 | -- |
14 | 16 | -- Known issue on iRedMail server: |
|
20 | 22 | -- fixes this issue. |
21 | 23 |
|
22 | 24 | -- |
23 | | --- Required by RHEL/CentOS 6. |
| 25 | +-- Required by PostgreSQL 8.x (RHEL/CentOS 6) |
24 | 26 | -- |
25 | 27 | -- CREATE LANGUAGE plpgsql; |
26 | 28 | -- \i /usr/share/pgsql/contrib/dblink.sql; |
27 | 29 |
|
28 | 30 | -- |
29 | | --- Required by RHEL/CentOS 7 |
| 31 | +-- Required by PostgreSQL 9.x (RHEL/CentOS 7, Debian 7, Ubuntu 14.04, ...) |
30 | 32 | -- |
31 | 33 | -- CREATE EXTENSION dblink; |
32 | 34 |
|
33 | | -CREATE VIEW global_addressbook AS |
| 35 | +CREATE VIEW global_addressbooks AS |
34 | 36 | SELECT * FROM dblink('host=127.0.0.1 port=5432 user=vmail password=xxx dbname=vmail', 'SELECT extract(epoch FROM created), name, username, domain FROM mailbox WHERE active=1') |
35 | 37 | AS global_addressbook ("ID" BIGINT, name VARCHAR(255), email VARCHAR(255), domain VARCHAR(255)); |
36 | 38 |
|
37 | | -ALTER TABLE global_addressbook OWNER TO roundcube; |
| 39 | +ALTER TABLE global_addressbooks OWNER TO roundcube; |
0 commit comments