-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Decide how to handle whitespace in db entries #5
Comments
FWIW, I found an Ubuntu PPA that provides the latest Postfix packages and tried v3.3.1. I received the same response from that version as from an earlier version. Leading whitespacepostalias queries
No response from bare search string.
Response from quoted search string with explicit leading space:
table entry
Trailing whitespacepostalias queries
Response from bare search string without any explicit trailing spaces (even though table entry contains one):
Response from no trailing space in search string (even though table entry contains one):
Response from explicit trailing space in search string:
table entry
|
related: #6 Because of our specific focus on interoperability with Postfix, those needs will supersede other concerns. I'll try to keep this in mind when evaluating handling of database fields and pre/post db validation. |
I've given this some thought and will loop back later with more details, but for the initial code drop the initial workflow can just be to mirror the source database exactly. I'll create a separate PR later to better define the expected workflow. |
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:
andtexthash:
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
but our new database would no longer reflect the source database
As part of a pre-create validation process, look for those whitespace issues
As part of the post-validation process, also look for those whitespace issues
process that might allow spaces to go undetected; though admittedly we
would probably share the same functions/code for validation in both places
References:
The text was updated successfully, but these errors were encountered: