From: | "Hartwig Jens" <Jens(dot)Hartwig(at)t-systems(dot)de> |
---|---|
To: | "Palle Girgensohn" <girgen(at)partitur(dot)se>, <pgsql-sql(at)postgresql(dot)org> |
Subject: | AW: Column reference X is ambiguous? |
Date: | 2001-05-28 06:26:31 |
Message-ID: | 819FEEAC94E6DC459F1FDC83C0C1611F1D7D62@mail2000.b3.dsh.de |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
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(dot)hartwig(at)t-systems(dot)de
Internet: http://www.t-systems.de
> -----Ursprüngliche Nachricht-----
> Von: Palle Girgensohn [mailto:girgen(at)partitur(dot)se]
> Gesendet: Montag, 28. Mai 2001 03:37
> An: pgsql-sql(at)postgresql(dot)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(at)postgresql(dot)org
>
From | Date | Subject | |
---|---|---|---|
Next Message | Martín Marqués | 2001-05-28 09:08:44 | Re: Recursive select |
Previous Message | Tom Lane | 2001-05-28 06:09:16 | Re: Column reference X is ambiguous? |