Re: [webmin-l] Postfix Virtual Domains MySQL Module Setup

"Jamie Cameron" <[email protected]>
Newsgroups gmane.comp.web.webmin.general
Message-ID <[email protected]>
On 19/Jun/2016 14:48 Paul R. Ganci <[email protected]> wrote ..
> According to the Postfix documentation on MySQL table configuration 
> (http://www.postfix.org/mysql_table.5.html) there is an obsolete query 
> interface and a preferred query interface. For the obsolete query 
> interface two fields have to be specified... namely the select_field and 
> the where_field. The postfix MySQL configuration file 
> /etc/postfix/mysql_virtual_maps.cf would look like this (names have been 
> changed):
> 
> user = postuser
> password = Xjk_1xxx
> dbname = postfix
> select_field = destination
> where_field = email
> table = postfix_virtual
> 
> The select_field and where_field correspond to the Webmin Postfix 
> Virtual Domains module setup Map Specifications
> 
> mysql:/etc/postfix/mysql_virtual_maps.cf
> 
> MySQL database Key field email and Value field destination. If I select 
> the "SQL for where clause" checkbox for the MySQL database everything 
> works as expected. However I would like to use the preferred query 
> postfix mechanism. In that case the Postfix MySQL configuration file 
> contains
> 
> user = postuser
> password = Xjk_1xxx
> dbname = postfix
> select_field = destination
> where_field = email
> query = SELECT destination FROM postfix_virtual WHERE email = '%s'
> table = postfix_virtual
> 
> So I tried to set up the Map Specifications by setting the Key field 
> blank, Value field blank, selecting the "None" check box and then adding 
> the query:
> 
> SELECT destination FROM postfix_virtual WHERE email = %s
> 
> into the box next to the the None check box. This does not work as I get 
> config errors regarding the missing Key and Value fields. If I set the 
> key and value fields per the obsolete query I then get errors about an 
> error in my MySQL syntax:
> 
> SQL query failed: You have an error in your SQL syntax; check the manual 
> that corresponds to your MariaDB server
> version for the right syntax to use near 'SELECT destination FROM 
> postfix_virtual WHERE email = '%s'' at line 1
> 
> If I remove the select_field and where_field from the postfix config file
> 
> user = postuser
> password = Xjk_1xxx
> dbname = postfix
> table = postfix_virtual
> query = SELECT destination FROM postfix_virtual WHERE email = '%s'
> 
> Then I get this error:
> 
> This map cannot get edited. The MySQL configuration parameter 
> select_field was not found. Webmin needs this to figure which table and 
> fields to query.
> 
> Is there any plan to make Webmin work with the preferred Query? It seems 
> webmin has everything it needs with the query definition in the MySQL 
> configuration file. Presently I am finding that I have to use the second 
> form of the /etc/postfix/mysql_virtual_maps.cf file to get both Postfix 
> and Webmin happy. I would like to migrate to the last 
> /etc/postfix/mysql_virtual_maps.cf form to avoid the obsolete parameters 
> but cannot do that if Webmin does not recognize the MySQL configuration.

Unfortunately in the current release, Webmin cannot parse the SQL from
the 'query' field, and so needs the old separate 'table' , 'select' and
'where' fields. The reason for this is that it doesn't just execute
the query - if you edit a map, Webmin also needs to know which field in
which table to update.

However, in the next release I will attempt to extract these from simple
queries (like yours), so that the new recommended config format works.

------------------------------------------------------------------------------
Attend Shape: An AT&T Tech Expo July 15-16. Meet us at AT&T Park in San
Francisco, CA to explore cutting-edge tech and listen to tech luminaries
present their vision of the future. This family event has something for
everyone, including kids. Get more information and register today.
http://sdm.link/attshape
-
Forwarded by the Webmin mailing list at [email protected]
To remove yourself from this list, go to
http://lists.sourceforge.net/lists/listinfo/webadmin-list
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.