On 14/09/2016 04:01, Viktor Dukhovni wrote:
On Tue, Sep 13, 2016 at 09:52:16PM +0200, Antoine Nguyen wrote:

query = SELECT name FROM admin_domain WHERE name='%s' AND type='domain' AND 
enabled=1
What is not clear is how MySQL's quoting behaves given the input
UTF-8 string.

postmap: cfg_get_str: /etc/postfix/sql-domains.cf: query = SELECT name FROM 
admin_domain WHERE name='%s' AND type='domain' AND enabled=1

postmap: dict_mysql: successful query from host 127.0.0.1

postmap: dict_mysql_lookup: retrieved 0 rows
I was hoping to see the expanded query string, but it is not output
with "-v".  Perhaps there's some sort of logging you can enable in
the MySQL server or client libraries.

Do make sure that your tests with the sql CLI really make the same
query against the same database:

     SELECT name FROM admin_domain WHERE name='<utf-8-domain>' AND 
type='domain' AND enabled=1

I've enabled queries logging. Here is the result :

160914  8:24:14       57 Query    SELECT name FROM admin_domain WHERE 
name='gaël.com' AND type='domain' AND enabled=1

160914  8:24:31       60 Connect    modoboa@localhost as anonymous on modoboa

                      60 Query    SELECT name FROM admin_domain WHERE 
name='gaël.com' AND type='domain' AND enabled=1

                      60 Quit

The first query was executed using mysql shell and it returns 1 row. The second query was executed by postmap and returns nothing whereas we can see they are the same...

Antoine

Reply via email to