Re: union of types in a different category

From: James Harper <james(dot)harper(at)bendigoit(dot)com(dot)au>
To: Brent Wood <Brent(dot)Wood(at)niwa(dot)co(dot)nz>
Cc: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: union of types in a different category
Date: 2014-02-22 23:14:43
Message-ID: 6035A0D088A63A46850C3988ED045A4B6F3AFF88@BITCOM1.int.sbss.com.au
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

>
> Interestingly - & i'm curious as to why"
>
> SELECT '1' UNION SELECT 2;
> ?column?
> ----------
> 1
> 2
> (2 rows)
>
> SELECT '1' UNION SELECT 1;
> ?column?
> ----------
> 1
> (1 row)
>
>
> I didn't think UNION did an explicit "distinct" - if that is what is happening?
>

UNION removes duplicates. UNION ALL does not.

James

In response to

Browse pgsql-general by date

  From Date Subject
Next Message James Harper 2014-02-22 23:16:58 Re: union of types in a different category
Previous Message Brent Wood 2014-02-22 23:12:26 Re: union of types in a different category