Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 23 Nov 2004 01:00:28 +0100
From:      Peter Schuller <peter.schuller@infidyne.com>
To:        freebsd-questions@freebsd.org
Cc:        "Bill Schmitt \(SW\)" <software@schmittnet.com>
Subject:   Re: Setting up Postfix with PosgreSQLon FreeBSD
Message-ID:  <200411230100.30160.peter.schuller@infidyne.com>
In-Reply-To: <41A277A1.5080001@schmittnet.com>
References:  <41A24148.1000400@schmittnet.com> <41A2840D.9020104@confabulator.net> <41A277A1.5080001@schmittnet.com>

next in thread | previous in thread | raw e-mail | index | archive | help
Hello,

> Thanks for responding, Ryan, but I'm confused. I have managed to start
> postgres with a user I called pgsql. The install appears to do that with
> a user called postgres but doesn't reference postfix. How do I tell
> postfix that I want to use postgres?

Basically in main.cf you must specify postgresql databases rather than the 
default ones. For example, on one machine where I use Postfix+PostgreSQL, I 
have (among other things):

alias_maps = pgsql:/usr/local/etc/postfix/pgsql-localaliases.cf
virtual_alias_maps = pgsql:/usr/local/etc/postfix/pgsql-aliases.cf
virtual_mailbox_maps = pgsql:/usr/local/etc/postfix/pgsql-mailboxes.cf

Each of the files referenced contains the information postfix needs in order 
to query the postgresql database. For example, pgsql-localaliases.cf 
contains:

hosts = localhost
user = mail
password = YOUR_DB_PASSWORD_HERE
dbname = YOUR_PG_DB_NAME_HERE
table = bla
query = SELECT local_alias.target FROM local_alias WHERE \
                          local_alias.address ILIKE '%s';

(linebreak added for readability)

The 'table' option is not needed, but IIRC when testing it would bail if the 
keyword itself was missing, even though it was never used since I opted for 
the 'query' option instead (hence "bla"). Instead of specifying the query 
like that, one can specify individual parts using table/where statements. I 
found it easier to just specify the whole query so that I know what's going 
on.

I haven't been following this thread so I don't know how much you already know 
or whether this helps. If this doesn't clear things up let me know and I can 
provide some URLs that are suitable for reading on this issue, and/or more 
details. At the moment I'm in a bit of a hurry.

-- 
/ Peter Schuller, InfiDyne Technologies HB

PGP userID: 0xE9758B7D or 'Peter Schuller <peter.schuller@infidyne.com>'
Key retrieval: Send an E-Mail to getpgpkey@scode.org
E-Mail: peter.schuller@infidyne.com Web: http://www.scode.org



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200411230100.30160.peter.schuller>