Search Postgresql Archives

Re: Fields re-ordered on JOIN with * and USING

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



"David G. Johnston" <david.g.johnston@xxxxxxxxx> writes:
> On Fri, Sep 1, 2017 at 2:25 PM, Ken Tanzer <ken.tanzer@xxxxxxxxx> wrote:
>> Hi.  I recently noticed that when doing a SELECT * with USING, that the
>> join field(s) appear first in the output.  I'd never noticed that before,
>> and was just curious if that is expected behavior or not.  Thanks.

> ​I don't recall if or where it is documented but it is intentional., as is
> the documented fact that only one instance of the named column appears in
> the output.

Yes, it's documented, here:

https://www.postgresql.org/docs/current/static/queries-table-expressions.html#QUERIES-FROM

under "7.2.1.1. Joined Tables":

    Furthermore, the output of JOIN USING suppresses redundant columns:
    there is no need to print both of the matched columns, since they must
    have equal values. While JOIN ON produces all columns from T1 followed
    by all columns from T2, JOIN USING produces one output column for each
    of the listed column pairs (in the listed order), followed by any
    remaining columns from T1, followed by any remaining columns from T2.

			regards, tom lane


-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]

  Powered by Linux