[Zope] Duplicate column name in ZSQL Method

Tres Seaver tseaver@palladion.com
Wed, 16 Feb 2000 11:37:37 -0600


Martin Fahlgren wrote:
> 
> Thanks a lot for your help! I've tried it out, but it only seems to work
> if I do some dirty hacks on the class Results. Otherwise I still get the
> "exceptions.ValueError: Duplicate column name" message.
> My query looks like this:
> 
> select book.*, borrowing.*, item.*, article.*
>    from borrowing borrowing, item item, article article, book book
> where
>    upper(book.title) like upper('%<dtml-var title>%')
>    and upper(book.author) like upper('%<dtml-var author>%')
>    and upper(book.subject) like upper('%<dtml-var subject>%')
>    and upper(book.isbn) like upper('%<dtml-var isbn>%')
>    and item.articleid = book.articleid
>    and article.articleid = book.articleid
>    and item.itemid = borrowing.itemid(+)
> 
> /Martin

In this case, I think you have two options:

 * Bite the bullet and name the columns you want from each table.

 * Supply a Python class as a "pluggable brain" for the result set.
   This class could embody the knowledge of the columns needed from
   each table, or mangle their names in order to avoid the conflict.
   Caveat:  I haven't done *any* work with pluggable brains.

Tres.
-- 
=========================================================
Tres Seaver         tseaver@palladion.com    713-523-6582
Palladion Software  http://www.palladion.com