[Dovecot] Unknown column username in where clause

Daniel Luttermann daniel at dlutt.de
Mon Jul 19 23:21:44 EEST 2010


Version: Dovecot 2.0 rc2

I'm testing Dovecot with MySQL quotas but I get always this error for
incoming mails:

tux dovecot: lmtp(4928): Error: user testuser at dlutt.de: Auth USER lookup failed
tux dovecot: auth: Error: mysql: Query failed, retrying: Unknown column 'username' in 'where clause'

I dont' know where the field "username" should come from because I
don't use this field (or query).

The relevant files are:

dovecot-sql.conf.ext
====================

password_query = SELECT userid AS user, password, \
  home AS userdb_home, uid AS userdb_uid, gid AS userdb_gid, \
  concat('*:bytes=', quota_bytes) as userdb_quota_rule \
  FROM users WHERE userid = '%u'

auth-sql.conf.ext
=================

passdb {
  driver = sql
  args = /etc/dovecot/dovecot-sql.conf.ext
}

userdb {
  driver = prefetch
}

userdb {
  driver = sql
  args = /etc/dovecot/dovecot-sql.conf.ext
}

90-quota.conf
=============

plugin {
  quota = dict:user::proxy::quota
  quota_rule = *:storage=0
}

dovecot-dict-sql.conf.ext
=========================

map {
  pattern = priv/quota/storage
  table = quota
  username_field = userid
  value_field = bytes
}
map {
  pattern = priv/quota/messages
  table = quota
  username_field = userid
  value_field = messages
}

I've grepped through all config files but I can't find any (active)
query which uses the above "where username=...".

The quota db gets correctly updated if an user logs in so the problem
only exists during mail delivery. My SQL tables were crated as
follows:

CREATE TABLE IF NOT EXISTS `users` (
  `userid` varchar(100) NOT NULL,
  `password` varchar(64) NOT NULL,
  `home` varchar(255) NOT NULL,
  `uid` int(11) NOT NULL,
  `gid` int(11) NOT NULL,
  `quota_bytes` varchar(10) NOT NULL,
  PRIMARY KEY  (`userid`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

CREATE TABLE IF NOT EXISTS `quota` (
  `userid` varchar(100) NOT NULL,
  `bytes` bigint(20) NOT NULL default '0',
  `messages` int(11) NOT NULL default '0',
  PRIMARY KEY  (`userid`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;


--
Daniel



More information about the dovecot mailing list