29.08.25, 14:00 +0200, Jan Marek via Postfix-users: > Hello, > > Dne čt, srp 28, 2025 at 02:43:59 CEST napsal(a) Markus Schönhaber via > Postfix-users: >> 28.08.25, 14:20 +0200, Jan Marek via Postfix-users: >> >>> But why `postmap -q` don't reply? >> >> >From man postmap(1): >> >> | -q key Search the specified maps for key and write the first value >> | found to the standard output stream. The exit status is zero when >> | the requested information was found. >> | >> | Note: this performs a single query with the key as >> | specified, and does not make iterative queries with substrings >> | of the key as described for access(5), canonical(5), >> | transport(5), virtual(5) and other Postfix table-driven >> | features. > > it's quite confusing:
You're probably confused because you compare a key-value store with a RE table and think they should behave alike. > /etc/postfix/virtual: > > [email protected] account1 > [email protected] account2 > @virtual.domain other_account > > postmap -q [email protected] hash:/etc/postfix/virtual > account1 > > postmap -q [email protected] hash:/etc/postfix/virtual > > (nothink and exit status of 1) As documented (see above): postmap looks for exactly "[email protected]" - which is not contained in your virtual file. > /etc/postfix/virtual.pcre > > /[email protected]/ account1 > /[email protected]/ account2 > /.*@virtual.domain$/ other_account > > postmap -q [email protected] pcre:/etc/postfix/virtual.pcre > account1 > > postmap -q [email protected] pcre:/etc/postfix/virtual.pcre > other_account With a PCRE table, postmap matches the query string against all patterns contained in the PCRE-file - and the RE "/.*@virtual.domain$/" matches the search string "[email protected]". > It would be advantage to test maps in way as in pcre... I don’t think so, Tim. I'd consider *that* very confusing. -- Regards mks _______________________________________________ Postfix-users mailing list -- [email protected] To unsubscribe send an email to [email protected]
