[GENERAL] Fields re-ordered on JOIN with * and USING - Mailing list pgsql-general

From Ken Tanzer
Subject [GENERAL] Fields re-ordered on JOIN with * and USING
Date
Msg-id CAD3a31W0mJHWNuvec-NSSSFUbABwJFp=ued_UYUqAM3vbP0i5Q@mail.gmail.com
Whole thread Raw
Responses Re: [GENERAL] Fields re-ordered on JOIN with * and USING  ("David G. Johnston" <david.g.johnston@gmail.com>)
List pgsql-general
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.

Ken

CREATE TEMP TABLE t1 (
  f1 INTEGER,
  f2 INTEGER UNIQUE,
  f3 INTEGER,
  f4 INTEGER
);

CREATE TEMP TABLE t2 (
  f2 INTEGER,
  f3 INTEGER,
  f5 INTEGER
);

SELECT * FROM t1 LEFT JOIN t2 USING (f3,f2);

 f3 | f2 | f1 | f4 | f5 
----+----+----+----+----
(0 rows)



-- 
AGENCY Software  
A Free Software data system
By and for non-profits
(253) 245-3801

learn more about AGENCY or
follow the discussion.

pgsql-general by date:

Previous
From: Bob Jones
Date:
Subject: Re: [GENERAL] Issue with json_agg() and ordering
Next
From: Paul Linehan
Date:
Subject: [GENERAL] Strange SQL result - any ideas.