[Zope-dev] dupe column names not supported (Shared.DC.ZRDB) ?

Casey Duncan casey@zope.com
Tue, 17 Dec 2002 14:25:27 -0500


The semantics of Zope's database functionality is such that duplicate col=
umn=20
names are not (and probably never will be) possible in the same result se=
t.=20
This is because Zope expects to access columns by name rather than positi=
on.=20
Therefore each one must have a distinct name.=20

The only workaround I can see would be some sort of automatic renaming of=
=20
columns, but that sounds like a bad idea since it introduces some serious=
 bug=20
potential if the columns are renamed differently then the application=20
expects.

Just for curiousity, what is the use case for returning multiple columns =
with=20
the same name? Sounds dubious to me.

-Casey

On Tuesday 17 December 2002 02:11 pm, Ross J. Reedstrom wrote:
> Same problem has been reported with Oracle 8.1, since it too will retur=
n
> duplicate names. The SQL92 spec is a bit ambiguous about whether all
> returned column names must be unique.
>=20
> Ross
>=20
> On Tue, Dec 17, 2002 at 01:09:13PM -0500, Adam Manock wrote:
> >=20
> > specifically with:
> >=20
> > SELECT W1.city, W1.temp_lo AS low, W1.temp_hi AS high,
> >     W2.city, W2.temp_lo AS low, W2.temp_hi AS high
> >     FROM weather W1, weather W2
> >     WHERE W1.temp_lo < W2.temp_lo
> >     AND W1.temp_hi > W2.temp_hi;
> >=20
> >=20
> > Error, exceptions.ValueError: Duplicate column name, city
> >=20
> > Traceback (innermost last):
> >   Module ZPublisher.Publish, line 98, in publish
> >   Module ZPublisher.mapply, line 88, in mapply
> >   Module ZPublisher.Publish, line 39, in call_object
> >   Module Shared.DC.ZRDB.Connection, line 115, in manage_test
> >   Module Shared.DC.ZRDB.Results, line 52, in __init__
> > ValueError: Duplicate column name, city