Received: from localhost (unknown [200.46.204.183]) by postgresql.org (Postfix) with ESMTP id 96FC42E2E69 for ; Sun, 27 Jan 2008 21:45:23 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 93096-04 for ; Sun, 27 Jan 2008 21:45:21 -0400 (AST) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by postgresql.org (Postfix) with ESMTP id 046A12E2E62 for ; Sun, 27 Jan 2008 21:45:20 -0400 (AST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.2/8.14.2) with ESMTP id m0S1jHoR016134; Sun, 27 Jan 2008 20:45:17 -0500 (EST) To: Bryce Nesbitt cc: pgsql-sql@postgresql.org Subject: Re: Syntax question: use of join/using with fully qualified table name In-reply-to: <479D2694.3090202@obviously.com> References: <479D2694.3090202@obviously.com> Comments: In-reply-to Bryce Nesbitt message dated "Sun, 27 Jan 2008 16:49:24 -0800" Date: Sun, 27 Jan 2008 20:45:17 -0500 Message-ID: <16133.1201484717@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200801/208 X-Sequence-Number: 30061 Bryce Nesbitt writes: > I've got a join where a certain column name appears twice: > select username,last_name from eg_member join eg_membership using > (member_id) join eg_account using (account_id) join eg_person using > (person_id); > ERROR: common column name "person_id" appears more than once in left table > My first inclination was to fully quality the table name. Why would > this not be acceptable syntax? Because USING is defined as joining common column names. It is driven entirely by the column names, not any "qualification", and it needs to have well-defined behavior. The SQL92 spec saith ::= USING ::= ::= [ { }... ] ::= ... b) If a is specified, then every in the shall be the of exactly one column of T1 and the of exactly one column of T2. regards, tom lane