pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Andreas Schmid <user462411@gmail.com>
Cc: pgsql-general <pgsql-general@postgresql.org>
Subject: Re: UNION ALL: Apparently based on column order rather than on column name or alias
Date: Thu, 06 Dec 2018 10:06:24 -0500
Message-ID: <13386.1544108784@sss.pgh.pa.us> (raw)
In-Reply-To: <CAKeZVDpNmfkQqkBT2x=zR=K58w1doHeCvJGQ84evAYNsKKXuZg@mail.gmail.com>
References: <CAKeZVDpNmfkQqkBT2x=zR=K58w1doHeCvJGQ84evAYNsKKXuZg@mail.gmail.com>

Andreas Schmid <user462411@gmail.com> writes:
> So my conclusion is that the result of UNION ALL depends on the column
> order, not on the column names or aliases. Is this the intended
> behaviour?

Yes, this is required by SQL spec.  Matching by column name would
be used if you wrote a CORRESPONDING clause, but we don't implement
that feature.

			regards, tom lane




view thread (2+ messages)

Message-ID: <13386.1544108784@sss.pgh.pa.us>
Permalink:  ../13386.1544108784@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/13386.1544108784@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: tgl@sss.pgh.pa.us, user462411@gmail.com
  Subject: Re: UNION ALL: Apparently based on column order rather than on column name or alias
  In-Reply-To: <13386.1544108784@sss.pgh.pa.us>
  References: <CAKeZVDpNmfkQqkBT2x=zR=K58w1doHeCvJGQ84evAYNsKKXuZg@mail.gmail.com> <13386.1544108784@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox