On Fri, May 24, 2013 at 04:37:25PM -0400, Thomas Polliard wrote:

> select array_to_string(array_agg(destination),',')
> from postfix.alias_destination
> where alias = (select alias_id
>                from postfix.alias_map
>                where alias = 'h...@example.com');

You're working too hard, Postfix automatically handles multiple
result rows, no need to do aggregation.

> This returns a comma separated list of destinations.
>        destination             
> -----------------------------------------
> tho...@example.com,oli...@example.com

Test with "postmap -q ...". This should return multiple output lines
one per recipient.

> May 24 10:01:03 helios postfix/pickup[25429]: D1DDF807AA: uid=0 from=<root>
> May 24 10:01:03 helios postfix/cleanup[25472]: warning: table 
> "pgsql:/etc/postfix/pgsql/virtual_alias_maps.cf": empty lookup result for: 
> "tho...@example.com" -- ignored

Perhaps a side-effect of the aggregation returning an empty string rather
than 0 rows.

For further help post the postgres table definition .cf file and the
output of postmap -f -q "h...@example.com" pgsql:/path/to/table.cf

-- 
        Viktor.

Reply via email to