Received: from neptun.sns-felb.debis.de (neptun.sns-felb.debis.de [53.122.101.2]) by postgresql.org (8.11.3/8.11.1) with SMTP id f4S6QlA16025 for ; Mon, 28 May 2001 02:26:47 -0400 (EDT) (envelope-from Jens.Hartwig@t-systems.de) Received: by neptun.sns-felb.debis.de; id IAA18510; Mon, 28 May 2001 08:26:48 +0200 Received: from unknown(53.47.15.3) by neptun.sns-felb.debis.de via smap (V5.0) id xma018495; Mon, 28 May 01 08:26:43 +0200 Received: from mail2000.b3.dsh.de (localhost [127.0.0.1]) by dshmail.dsh.de (8.8.7/8.8.7) with ESMTP id IAA18284; Mon, 28 May 2001 08:25:43 +0200 (MET DST) Subject: AW: Column reference X is ambiguous? MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Date: Mon, 28 May 2001 08:26:31 +0200 Message-ID: <819FEEAC94E6DC459F1FDC83C0C1611F1D7D62@mail2000.b3.dsh.de> content-class: urn:content-classes:message X-MimeOLE: Produced By Microsoft Exchange V6.0.4418.65 Thread-Topic: [SQL] Column reference X is ambiguous? Thread-Index: AcDnGQSlIb5Gu4eTSR2L9k+HwZsvhQAIkJQA From: "Hartwig Jens" To: "Palle Girgensohn" , Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by postgresql.org id f4S6QqA16046 X-Archive-Number: 200105/287 X-Sequence-Number: 3115 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 >