Mohsen Pahlevanzadeh
2013-Jun-21 23:25 UTC
[Dovecot] tables between dovecot and postfix and a paradoxical question
Dear all, I read we create the following table in wiki2 : CREATE TABLE users ( userid VARCHAR(128) NOT NULL, domain VARCHAR(128) NOT NULL, password VARCHAR(64) NOT NULL, home VARCHAR(255) NOT NULL, uid INTEGER NOT NULL, gid INTEGER NOT NULL ); But i read the following text in the official postfix documentation : "DO create tables with each matching item as a key and with an arbitrary value. With SQL databases it is not uncommon to return the key itself or a constant value." ref: http://www.postfix.org/mysql_table.5.html How can i combine together? --mohsen
Bradley Giesbrecht
2013-Jun-21 23:54 UTC
[Dovecot] tables between dovecot and postfix and a paradoxical question
On Jun 21, 2013, at 4:25 PM, Mohsen Pahlevanzadeh wrote:> Dear all, > > I read we create the following table in wiki2 : > CREATE TABLE users ( > userid VARCHAR(128) NOT NULL, > domain VARCHAR(128) NOT NULL, > password VARCHAR(64) NOT NULL, > home VARCHAR(255) NOT NULL, > uid INTEGER NOT NULL, > gid INTEGER NOT NULL > ); > > But i read the following text in the official postfix documentation : > "DO create tables with each matching item as a key and with > an arbitrary value. With SQL databases it is not uncommon > to return the key itself or a constant value." > ref: http://www.postfix.org/mysql_table.5.html > > How can i combine together?I'm not sure I understand you problem but for dovecot and postfix the important thing is to return the query result that meets your needs. How the tables are create and related does not really matter. If you are having problems it is most likely your select query. Regards, Bradley Giesbrecht (pixilla)
Benny Pedersen
2013-Jun-23 16:30 UTC
[Dovecot] tables between dovecot and postfix and a paradoxical question
Mohsen Pahlevanzadeh skrev den 2013-06-22 01:25:> How can i combine together?i created username like this: # sql dump SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO"; SET time_zone = "+00:00"; CREATE TABLE IF NOT EXISTS `username` ( `concat(userid,"@",domain)` varchar(257) ); CREATE TABLE IF NOT EXISTS `users` ( `userid` varchar(128) NOT NULL, `domain` varchar(128) NOT NULL, `password` varchar(64) NOT NULL, `home` varchar(255) NOT NULL, `uid` int(11) NOT NULL, `gid` int(11) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1; INSERT INTO `users` (`userid`, `domain`, `password`, `home`, `uid`, `gid`) VALUES ('me', 'example.org', 'password', 'homedir', 1000, 1000); DROP TABLE IF EXISTS `username`; CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `username` AS select concat(`users`.`userid`,'@',`users`.`domain`) AS `concat(userid,"@",domain)` from `users`; now username contains same info that postfixadmin creates :) -- senders that put my email into body content will deliver it to my own trashcan, so if you like to get reply, dont do it