[Zope] ZSQL: ValueError, Duplicate column name

Philipp Auersperg zope@philosoft.at
Mon, 05 Mar 2001 11:18:16 +0100


you have to alias at lleas on of the cols:

SELECT
  person.last_changed, work.last_changed as work_last_changed
FROM
  person, work
where [...join condition...]

phil

*********** REPLY SEPARATOR  ***********

On 05.03.2001 at 10:22 Andreas H=F6lzl wrote:

>hi,
>
>i have the following problem when using ZSQL with special SQL-queries:
>
>When creating a simple ZSQL-method for quering two different tables
>with both a column of the same name like
>
>SELECT
>  person.last_changed, work.last_changed
>FROM
>  person, work
>
>a ValueError  "Duplicate column name" occurs.
>I located the "problem" in "lib/python/Shared/DC/ZRDB/Results.py":
>
>123:            if schema.has_key(name):
>124:                raise ValueError, 'Duplicate column name, %s' %
>name
>
>I made a workaround with an external python method directly quering
>the database.
>
>But my question is:
>Is there also a workaround with dtml/ZSQL?
>
>I do not think that it is a good idea to force unique table column
>names for a complex database. Whats the reason for this limitation?
>dtml-var ?
>
>Thanks in advance,
>Andreas H=F6lzl
>Freiburg, Germany
>
>_______________________________________________
>Zope maillist  -  Zope@zope.org
>http://lists.zope.org/mailman/listinfo/zope
>**   No cross posts or HTML encoding!  **
>(Related lists - 
> http://lists.zope.org/mailman/listinfo/zope-announce
> http://lists.zope.org/mailman/listinfo/zope-dev )