Mailing List Archive

local_domains & MySQL trouble
Hi every one,

# This doesn't work:
domainlist local_domains = \
${lookup mysql {SELECT domain FROM domains \
WHERE type="local" }}

# This does:
domainlist local_domains = grickle.org : anti.grickle.org

# And so does this:
mysql> use maildb
Database changed
mysql> SELECT domain FROM domains
-> WHERE type="local";
+------------------+
| domain |
+------------------+
| grickle.org |
| anti.grickle.org |
+------------------+
2 rows in set (0.00 sec)

mysql>


The exim logs show just a normal relaying-reject. Nothing in panic (about
bad mysql queries, which I have done before).

Thanks,
jh
Re: local_domains & MySQL trouble [ In reply to ]
On Sat, Jul 20, 2002 at 10:22:04AM -0500, james@grickle.org wrote:
> # This doesn't work:
[thing that obviously shouldn't work]
> # This does:
> domainlist local_domains = grickle.org : anti.grickle.org
[thing that obviously should]
> # And so does this:
[database c&p]
> The exim logs show just a normal relaying-reject. Nothing in panic (about
> bad mysql queries, which I have done before).

Perhaps you ought to go and read about lookups then.

The reason is that the lookups do not work in the way you think they work
there. Lookups are expanded as needed, so saying "select all" doesn't work,
you need to select the actual lookup key and have the lookup succeed.

MBM

--
Matthew Byng-Maddick <mbm@colondot.net> http://colondot.net/
Re: local_domains & MySQL trouble [ In reply to ]
On Sat, 20 Jul 2002 james@grickle.org wrote:

> # This doesn't work:
> domainlist local_domains = \
> ${lookup mysql {SELECT domain FROM domains \
> WHERE type="local" }}

*How* doesn't it work? Have you run tests with debugging? What was the
output?

> # This does:
> domainlist local_domains = grickle.org : anti.grickle.org

So, does the result of that lookup yield "grickle.org : anti.grickle.org"?

> mysql> SELECT domain FROM domains
> -> WHERE type="local";
> +------------------+
> | domain |
> +------------------+
> | grickle.org |
> | anti.grickle.org |
> +------------------+

Looks like your lookup won't yield a colon separated list...

Find out how the list is separated, then read about the $sg{ expansion
item.

--
Philip Hazel University of Cambridge Computing Service,
ph10@cus.cam.ac.uk Cambridge, England. Phone: +44 1223 334714.
Re: local_domains & MySQL trouble [ In reply to ]
Sorry,

I got it working, I don't think the conversation between me and another
person got posted because I have a nasty habbit of forgetting to use 'reply-
all'.

All I had to do was add "AND domain='${domain}'" since the domainlist's are
all dynamically generated.

Philip Hazel said:
> On Sat, 20 Jul 2002 james@grickle.org wrote:
>
>> # This doesn't work:
>> domainlist local_domains = \
>> ${lookup mysql {SELECT domain FROM domains \
>> WHERE type="local" }}
>
> *How* doesn't it work? Have you run tests with debugging? What was the
> output?
>
>> # This does:
>> domainlist local_domains = grickle.org : anti.grickle.org
>
> So, does the result of that lookup yield "grickle.org :
> anti.grickle.org"?
>
>> mysql> SELECT domain FROM domains
>> -> WHERE type="local";
>> +------------------+
>> | domain |
>> +------------------+
>> | grickle.org |
>> | anti.grickle.org |
>> +------------------+
>
> Looks like your lookup won't yield a colon separated list...
>
> Find out how the list is separated, then read about the $sg{ expansion
> item.
>
> --
> Philip Hazel University of Cambridge Computing Service,
> ph10@cus.cam.ac.uk Cambridge, England. Phone: +44 1223 334714.


James Harr <james@grickle.org>
http://www.grickle.org