PostgreSQL SELECT question

Ian Petersen ispeters-Re5JQEeQqe8AvxtiuMwx3w at public.gmane.org
Thu Aug 30 18:09:40 UTC 2007


Sorry, I didn't really parse all the SQL you posted in your original
email.  I assumed that you would create a view that performs the
necessary join to recreate the old table structure from the new
structure.  If you did that, then the existing query you're using to
get the file from the email address should still work.

I suppose you want something like this:

CREATE VIEW address_to_filesystem AS
SELECT u.usr_email || '@' || d.dom_name as address,
       d.dom_name || '/' || u.usr_email || '/inbox' as file
FROM users u JOIN domains d ON u.usr_dom_id = d.dom_id;

The above should create a view with fields address and file where the
address is 'user at domain' and the file is 'user/domain/inbox'.  Then
you can tell Postfix to

SELECT file FROM address_to_filesystem WHERE address = 'user at domain';

HTH,
Ian

-- 
Tired of pop-ups, security holes, and spyware?
Try Firefox: http://www.getfirefox.com
--
The Toronto Linux Users Group.      Meetings: http://gtalug.org/
TLUG requests: Linux topics, No HTML, wrap text below 80 columns
How to UNSUBSCRIBE: http://gtalug.org/wiki/Mailing_lists





More information about the Legacy mailing list