Received: from maia.hub.org (maia-2.hub.org [200.46.204.251]) by mail.postgresql.org (Postfix) with ESMTP id A9AD4B5DBD7 for ; Mon, 13 Jun 2011 14:00:42 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.251]) (amavisd-maia, port 10024) with ESMTP id 29970-03 for ; Mon, 13 Jun 2011 17:00:36 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-ey0-f174.google.com (mail-ey0-f174.google.com [209.85.215.174]) by mail.postgresql.org (Postfix) with ESMTP id 1DAF8B5DBDB for ; Mon, 13 Jun 2011 14:00:35 -0300 (ADT) Received: by eyx24 with SMTP id 24so1668835eyx.19 for ; Mon, 13 Jun 2011 10:00:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=gvuigVvWLh3GF87hNVUIA93oOvFoXvUwXEahETACMJg=; b=dPrtAHRLgS/ETbX1UZgQ+ggoRvJdVWOAHcrUytrYOZ5/CYkhTeiIg1iQsk9ZVvQKh6 VX4g0+vk4F2gCfFI+zHp4aEBFuQo34t3ChNA4EzZEqGe8SI008+2FNqcrc546kKp2hnU NCRVDHQXS/hFRDuECcorTJJ9Rq6FmEqQCHuz8= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; b=R7yWmSlK/nYJbZBGE6TJLIBRnc7qxQWFKVgvra3EhxUXySv7Wz1YwN+oPNWaXL7o4x 1oYKxEQoALQmM5OVSFFEVOuqNAjeBIOJ/otfXarXGHHVaqujJNJG7/WfIvTfWlXYmCMf iWA9uFzhRQ4cvK4N+JdEjJSu/XwVTk3usFX1g= MIME-Version: 1.0 Received: by 10.14.100.202 with SMTP id z50mr2541912eef.215.1307984435047; Mon, 13 Jun 2011 10:00:35 -0700 (PDT) Received: by 10.14.96.4 with HTTP; Mon, 13 Jun 2011 10:00:34 -0700 (PDT) In-Reply-To: References: Date: Mon, 13 Jun 2011 13:00:34 -0400 Message-ID: Subject: Re: 7.2. Table Expressions suggestion about NATURAL JOIN From: Robert Haas To: Grzegorz Szpetkowski Cc: pgsql-docs@postgresql.org Content-Type: text/plain; charset=ISO-8859-1 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.002 tagged_above=-5 required=5 tests=FREEMAIL_FROM=0.001, RFC_ABUSE_POST=0.001 X-Spam-Level: X-Archive-Number: 201106/44 X-Sequence-Number: 6818 On Tue, May 17, 2011 at 9:47 PM, Grzegorz Szpetkowski wrote: > http://www.postgresql.org/docs/9.0/static/queries-table-expressions.html > http://www.postgresql.org/docs/9.0/static/sql-select.html > > Respectively: > > "Finally, NATURAL is a shorthand form of USING: it forms a USING list > consisting of all column names that appear in both input tables. As > with USING, these columns appear only once in the output table." > > and > > "NATURAL is shorthand for a USING list that mentions all columns in > the two tables that have the same names." > > To make that comprehensive you can add something like: "Note that if > there is no any "shared" column between tables, then NATURAL JOIN acts > like ON TRUE (that is, tables are cross-joined)", because it's not > obvious. Done, with different wording. -- Robert Haas EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company