[Zope-DB] (no subject)

Matthew T. Kromer matt@zope.com
Thu, 19 Dec 2002 06:11:10 -0500


On Thursday, December 19, 2002, at 06:00 AM, Gareth Evans wrote:

> hi I'm using
> (Zope 2.5.1 (binary release, python 2.1, win32-x86), python 2.1.3,  
> win32)
> with
> ZMySQLDA (Installed product ZMySQLDA (ZMySQLDA 2.0.8))   
> <ZMySQLDA/manage_workspace>
> this seems to work fine for simple selects inserts etcetera but I'm  
> trying to do the following join in a z sql method
>
>
> select * from snmp_trap_entry, snmp_trap_vars where  
> snmp_trap_vars.auto=snmp_trap_entry.auto and snmp_trap_vars.auto=4
>
> I get the following failure
> Error Type: ValueError
> Error Value:
> Voyager Error Voyager has encountered an error while publishing this  
> resource. Error Type: ValueError Error Value: Duplicate column name,  
> auto	
>
> the above command works fine when I run it from the mysql prompt
>
> auto	trap	datestamp	trapoid	trapfull	target	enterprise	community	 
> generictrap	specifictrap	version	severity	ack	auto	var	num
> 4	LINKDOWN	2002-12-17  
> 16:52:36	0	NULL	192.0.2.1/161	NULL	NULL	NULL	NULL	NULL	1	0	4	4	1
>
>
You'll note the column "auto" shows up twice in your results, because  
you ask for it from both tables.  Zope doesn't know that it is the same  
column, constrained by the join, so it complains.

You can use Select column AS column1 notation to work around this,  
although that is more clumsy to type.