From: Hartwig Jens <Jens.Hartwig@t-systems.de>
To: Palle Girgensohn <girgen@partitur.se>
To: pgsql-sql@postgresql.org
Subject: AW: Column reference X is ambiguous?
Date: Mon, 28 May 2001 08:26:31 +0200
Message-ID: <819FEEAC94E6DC459F1FDC83C0C1611F1D7D62@mail2000.b3.dsh.de> (raw)
Hello Palle,
in my opinion the error message is completely correct. It is not
necessary that GROUP-BY-Attributes have to be included in the
SELECT-Clause.
The following query would be correct either:
SELECT count(*) as count
FROM read_faq rf,
GROUP BY userid;
I wonder why your query should have run before 7.1.x, even one of my old
test-databases (7.0.2) does not permit a query with ambiguous attributes
in the GROUP-clause.
Best regards, Jens Hartwig
-----------------------------------------------------
T-Systems
Project Manager
debis Systemhaus GEI GmbH
Address: Eichhornstraße 3, 10785 Berlin
Postal Address: 10785 Berlin
Phone: (004930) 25 54-32 82
Fax: (004930) 25 54-31 87
Mobile: (0170) 167 26 48
E-Mail: jens.hartwig@t-systems.de
Internet: http://www.t-systems.de> -----Ursprüngliche Nachricht-----
> Von: Palle Girgensohn [mailto:girgen@partitur.se]
> Gesendet: Montag, 28. Mai 2001 03:37
> An: pgsql-sql@postgresql.org
> Betreff: [SQL] Column reference X is ambiguous?
>
>
> Hi!
>
> SELECT count(rf.userid) as count, rf.userid FROM read_faq rf,
> faq f,
> deltagare_saved d, person p WHERE rf.id = f.id AND f.kursid=20
> AND
> d.course_id = f.kursid AND d.userid = rf.userid AND
> p.userid = d.userid GROUP BY userid
>
> ERROR: Column reference "userid" is ambiguous
>
>
> All of the tables have a userid, yes, but this query didn't
> fail before 7.1.x. Is it really OK to fail in this case? I
> thought SQL standard requires all GROUP|ORDER BY arguments to
> acutally exist on the SELECT target list. Then, this makes me
> puzzled... Are the joins making the userids get included in the
> target in some hidden way?
>
> /Palle
>
> ---------------------------(end of
> broadcast)---------------------------
> TIP 1: subscribe and unsubscribe commands go to
> majordomo@postgresql.org
>
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: Jens.Hartwig@t-systems.de, girgen@partitur.se
Subject: Re: AW: Column reference X is ambiguous?
In-Reply-To: <819FEEAC94E6DC459F1FDC83C0C1611F1D7D62@mail2000.b3.dsh.de>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox