-
Notifications
You must be signed in to change notification settings - Fork 1
Description
Test environment is Ubuntu 16.04 LTS with Postfix 3.1.0.
According to the Postfix 3.2.0 release announcement, the support was added to the postmap command, inline: and texthash: maps for spaces in the left-hand field of lookup tables. I'm not sure if MySQL and SQLite lookup tables already have this support, but when purposefully introducing spaces in the SQL template data file I'm using in development I got back inconsistent behavior.
If the left-hand side of the lookup table (the column I was searching against) had a leading space, I would not get back any results for the query, whether quoting a value not containing a space or not. If I quoted a search string that included a leading space, I got back a solid result.
If the left-hand side of the lookup table had a trailing space, the search string could either include the trailing space (quoted) or leave it out (with or without quoting of the search string) and a successful lookup would occur in both cases.
I suppose it goes without saying, but stray whitespace in the source database is problematic. The workarounds are numerous, but here are a few:
-
Strip leading/trailing whitespace from all fields when writing to SQLite database
- presumably this would make Postfix happy when actually using the SQLite db,
but our new database would no longer reflect the source database
- presumably this would make Postfix happy when actually using the SQLite db,
-
As part of a pre-create validation process, look for those whitespace issues
- skip those fields?
- copy the field values as-is (seems like the safest bet)
- flag rather noisily the problem (also seems like a good initial choice)
-
As part of the post-validation process, also look for those whitespace issues
- this could help cover potential regressions in the pre-create validation
process that might allow spaces to go undetected; though admittedly we
would probably share the same functions/code for validation in both places
- this could help cover potential regressions in the pre-create validation
References: