Postgresql – Dovecot – auth: Fatal: Unknown database driver ‘pgsql’

dovecotpostfixpostgresql

I'm trying to configure Dovecot + Postfix + PostfixAdmin with postgresql support.
I successfully configured postfix to send emails to aliases for my domain, and now I want to configure actual mailboxes support on my server.
I followed the configuration options for database support on dovecot 2 wiki (http://wiki.dovecot.org/AuthDatabase/SQL), dovecot starts without errors, but at the first attempt to connect by IMAP, dovecot complains on maillog:

auth: Fatal: Unknown database driver 'pgsql'

I'm sure dovecot has postgres support, here's the output for dovecot –build-options:

Build options: ioloop=epoll notify=inotify ipv6 openssl io_block_size=8192
Mail storages: cydir dbox maildir mbox mdbox raw shared
SQL driver plugins: mysql postgresql sqlite
Passdb: checkpassword ldap pam passwd passwd-file shadow sql
Userdb: checkpassword ldap(plugin) nss passwd prefetch passwd-file sql

Additional information:

/etc/dovecot/conf.d/auth-sql.conf.ext

passdb {
  driver = pgsql
  # Path for SQL configuration file, see example-config/dovecot-sql.conf.ext
  args = /etc/dovecot/conf.d/dovecot-sql.conf.ext
}

For driver section I tried: 'pgsql, 'postgresql' and 'sql', I always get the error.

/etc/dovecot/conf.d/dovecot-sql.conf.ext

connect = host=localhost dbname=postfix user=postfix password=secret
default_pass_scheme = CRYPT
password_query = SELECT userid as user, password FROM users WHERE userid = '%u'
user_query = SELECT '/home/'||home AS home, uid, gid FROM users WHERE userid = '%u'

Any idea about something I'm missing?
Thank you.

Best Answer

On CentOS 6 is necessary to install not only the dovecot package, but also the additional modules, in this case the package dovecot-pgsql is also needed for postgresql support.

The right syntax for the driver line in /etc/dovecot/conf.d/auth-sql.conf.ext is:

driver = sql

and then the right driver is specified in /etc/dovecot/conf.d/dovecot-sql.conf.ext

driver = pgsql