On 8/3/2011 11:05 AM, Jirka Bourek wrote: > Noel Jones wrote: >> >> Seems to me if you're getting a "relay access denied" then the >> @testing.domain is working, and you have some other rule that's >> rejecting the mail. Or maybe you somehow removed "testing.domain" >> from relay_domains. >> >> Sorry, I don't debug SQL. I suggest you get it working with flat >> files first, then duplicate the setup with your SQL. > > With flat files it works as expected - when I add "testing.domain" > into relay_domains and "@testing.domain OK" into > relay_recipient_maps hash file, Postfix accepts the mail and > forwards it. > >> >> >>> >>> I was expecting Postfix to send some query with "@testing.domain" >>> (which would hint me what should I add into DB), but no such query >>> in PostgreSQL log. >>> >>> Any ideas? >> >> Maybe your query is broken. >> > > That's not what I meant. Le me explain: > > Let's say I use hash file for relay_recipient_maps, and send e-mail > to recipient@testing.domain. According to Postfix log, it tries to > find "recipient@testing.domain" in the hash file. It doesn't find > the record, so in the next step it tries to find "@testing.domain"; > that's there in the form "@testing.domain OK", so Postfix accepts > the mail.
Good. That's how it should work. > > When I switch to pgsql, Postfix tries to find > "recipient@testing.domain" in DB. Again, it finds nothing, but this > time the other step - attempt to find @testing.domain somehow - is > skipped and Postfix returns error right away. > > So while it's possible that my query is broken, I was assuming that > Postfix will try it regardless. Nothing in the postfix docs support your claim -- postfix relay_recipient_maps behaves the same regardless of the data source. I think your query is broken. Sorry, I can't help further with debugging your query. Consider starting a new thread and including your queries, logs, and postconf -n. -- Noel Jones