I'm a doofus: I was using the 'REGEX' keyword. Which doesn't exist. REGEXP
works fine, except that the results don't seem to make sense...

mysql> select alias,deliver_to from dbmail_aliases where
'[EMAIL PROTECTED]' regexp alias;
+------------+------------+
| alias      | deliver_to |
+------------+------------+
| postmaster | 6          |
+------------+------------+


We need to be mindful of cross-SQL portability. What do you think about
the LIKE alternative using only % and _, which are standard SQL since
forever?

Aaron


Micah <[EMAIL PROTECTED]> said:

> Aaron,
> 
> I'm still not sure I support the idea, but:
> 
> SELECT deliver_to FROM dbmail_aliases WHERE 'deliveryaddress' REGEXP alias;
> 
> should work fine in MySQL, dunno if there's an equivilent statement in PG 
> though. 
> 
> -Micah 
> 
> On Tuesday 19 October 2004 01:05 pm, Aaron Stone wrote:
>> Blake Mitchell <[EMAIL PROTECTED]> said:
>> > Why not take this one step further, and go with full glob or regex
>> > support? This would allow nearly any conceivable case.
>>
>> I don't know how we'd support this in the database. We'd use the alias
>> column of the dbmail_aliases table like this:
>>
>>   alias          | deliver_to
>>   -------------------------------------
>>   [EMAIL PROTECTED]        |  9
>>   [EMAIL PROTECTED]  |  [EMAIL PROTECTED]
>>   [EMAIL PROTECTED]      |  34
>>   -------------------------------------
>>
>> Except that this doesn't work because, at least MySQL, cannot use the
>> REGEX keyword like this:
>>
>>   SELECT deliver_to FROM dbmail_aliases WHERE '[EMAIL PROTECTED]' REGEX
>> alias;
>>
>> However... if we use SQL wildcards, you're in luck:
>>
>>   alias           | deliver_to
>>   -------------------------------------
>>   [EMAIL PROTECTED]    | [EMAIL PROTECTED]
>>
>>   SELECT deliver_to FROM dbmail_aliases WHERE '[EMAIL PROTECTED]' LIKE
>> alias;
>>
>> Works perfectly. Could someone test PostgreSQL, too? This might solve
>> everything in one fell swoop...
>>
>> Aaron
>>
>> --
>> _______________________________________________
>> Dbmail-dev mailing list
>> Dbmail-dev@dbmail.org
>> http://twister.fastxs.net/mailman/listinfo/dbmail-dev
> _______________________________________________
> Dbmail-dev mailing list
> Dbmail-dev@dbmail.org
> http://twister.fastxs.net/mailman/listinfo/dbmail-dev
> 

-- 



Reply via email to