Hi Marc,

I will have a closer look to your issue. Let me expose my thoughts below...

1. The quick fix...

To quickly solve your problem, in the case you are not interested by
address rewrites, just remove the `RecipientRewriteTable` from
recipientrewritetable.xml...

2. My analysis of the problem...

 - Apache James uses JPA to query SQL database in a generic fashion
 - Unit tests are written on top of an embedded derby database
 - This very query is quite complex and work like a charm on derby
 - But very sadly you tend to prove that it fails on top of MariaDB
 - SQL syntax corner cases might be involved here...

For the record, here is how the JPA query looks like:

@NamedQuery(name = "selectExactMappings", query = "SELECT rrt FROM
JamesRecipientRewrite rrt WHERE (rrt.user LIKE :user) and (rrt.domain
like :domain) ORDER BY rrt.domain DESC")

It is very true that we miss manual and automated testing against other
databases. Contributions are more than welcomed on this!

Now that this is said, a quick fix would be to write less 'optimized
code' generating more queries but with a simpler syntax that would be
more portable.

Once again, I worked on a fix...


JIRA: https://issues.apache.org/jira/browse/JAMES-2655

FIX: https://github.com/linagora/james-project/pull/2145

Hope this solves your problem...

Wouldn't you mind building the fixed version of James and see if this
solves your issue?

Thanks for the very valuable feedbacks!

Cheers,

Benoit

On 1/26/19 10:36 AM, Marc Chamberlin wrote:
> I have no way to grok what the intent is, nor the details of what this
> query is expecting in the database, but upon a first look through the
> SQL documentation I changed this query by putting quotes around the
> question marks '?' in the LIKE clauses and MariaDB accepted it. i.e. -
> 
> SELECT t0.DOMAIN_NAME, t0.USER_NAME, t0.TARGET_ADDRESS FROM
> JAMES_RECIPIENT_REWRITE t0 WHERE (t0.USER_NAME LIKE '?' ESCAPE '\\' AND
> t0.DOMAIN_NAME LIKE '?' ESCAPE '\\') ORDER BY t0.DOMAIN_NAME DESC;
> 
> This is just a guess on my part, but me thinks this might be a bug in
> how Apache James is constructing this query?   Marc...
> 
> 
> On 01/25/2019 01:25 PM, Marc Chamberlin wrote:
>> SELECT t0.DOMAIN_NAME, t0.USER_NAME, t0.TARGET_ADDRESS FROM
>> JAMES_RECIPIENT_REWRITE t0 WHERE (t0.USER_NAME LIKE ? ESCAPE '\\' AND
>> t0.DOMAIN_NAME LIKE ? ESCAPE '\\') ORDER BY t0.DOMAIN_NAME DESC; 
> 
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: server-user-unsubscr...@james.apache.org
For additional commands, e-mail: server-user-h...@james.apache.org

Reply via email to