Login | Register
My pages Projects Community openCollabNet

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Catacomb] bug: DASL search fails when a query mentions a dead property more than once

Using cadaver, this command fails with internal server error:

search someprop = "value1" or someprop = "value2"

(while this one works ok: search someprop1 = "value1" or someprop2 = "value2")

The error in the log file is:

Error Number: 1066
ErrorMessage:Not unique table/alias: 'someprop_t'

For the above search, the following SQL query is generated inside catacomb:

SELECT distinct [..columns..] FROM dasl_resource left join dasl_property someprop_t USING (serialno) left join dasl_property someprop_t USING (serialno) WHERE [..bla..] ((someprop_t.name = 'someprop' AND someprop_t.value = 'value1' ) OR (someprop_t.name = 'someprop' AND someprop_t.value = 'value2' ))

As you can see, the same temporary table name is being used for both conditions. I was thinking of fixing this by appending some unique suffix to all the temporary table names (maybe some increasing integer), but I'm not sure how to implement it yet, because the same suffix will need to be used accross several functions inside search.c. If anybody has any idea how to solve this please send mail. If I manage to fix this I'll post the patch.