On Fri, Jan 27, 2012 at 12:54:46PM -0500, Wietse Venema wrote: > /dev/rob0: > > Postfix 2.9.0-RC2, trying to send to an external address with > > an apostrophe: > > > > rob0@chestnut:~$ fortune -o | mail -so "Joe's"@example.net > > rob0@chestnut:~$ mailq > > ----Queue ID----- --Size-- ---Arrival Time---- > > --Sender/Recipient------ > > 3TZMM8068wzp1Qr 405 Fri Jan 27 08:05:08 rob0 > > Joe's...@example.net > > > > and this is logged: > > > > Jan 27 08:05:08 chestnut postfix/pickup[20923]: 3TZMM80HjFzBn8B2: > > uid=1007 from=<rob0> > > Jan 27 08:05:08 chestnut postfix/cleanup[20967]: fatal: > > dict_sqlite_lookup: /etc/postfix/query/maps-valias.query: SQL > > prepare failed: near "s": syntax error? > > Postfix runs the search string through sqlite3_mprintf("%q"), which > is documented to double single quotes to avoid SQL syntax troubles > when the string is used in a query like this: > > SELECT select_field FROM table WHERE where_field = '%s' > > You can verify that this happens with verbose Postfix logging.
Changed cleanup and trivial-rewrite to -v, reloaded. $ fortune -o | mail -so "Joe's"@example.net ; sleep 2 ; mailq ----Queue ID----- --Size-- ---Arrival Time---- --Sender/Recipient------ 3TZSg13DMWz1mZx 454 Fri Jan 27 12:04:13 chuck Joe's...@example.net -- 0 Kbytes in 1 Request. $ sqlite3 --version 3.6.23.1 Logged (a bunch of other stuff and) this query: Jan 27 12:04:13 chestnut postfix/cleanup[22861]: dict_sqlite_lookup: /etc/postfix/query/maps-valias.query: Searching with query SELECT TA.localpart || (CASE WHEN VA.extension IS NOT NULL? THEN '-' || VA.extension ELSE '' END) ||? (CASE WHEN TD.id=0 THEN '' ELSE '@' || TD.name END)?FROM Alias AS VA? JOIN Address AS TA ON (VA.target = TA.id)? JOIN Domain AS TD ON (TA.domain = TD.id)? JOIN Address AS AA ON (VA.address = AA.id)? JOIN Domain AS AD ON (AA.domain = AD.id)?WHERE AA.localpart || '@' || AD.name IS 'joe's...@example.net'?AND VA.active!=0 ---------------^ single apostrophe here I will try with a more recent sqlite3 version, thanks. -- http://rob0.nodns4.us/ -- system administration and consulting Offlist GMX mail is seen only if "/dev/rob0" is in the Subject: