Re: [HACKERS] Reference Manual] - Mailing list pgsql-hackers

From Bruce Momjian
Subject Re: [HACKERS] Reference Manual]
Date
Msg-id 199803301525.KAA13181@candle.pha.pa.us
Whole thread Raw
In response to Reference Manual  ("Jose' Soares Da Silva" <sferac@proxy.bazzanese.com>)
List pgsql-hackers
> 2. - Seems that optional ALL keyword of UNION doesn't work.
>      The following query prints always the same result with and without
>      the ALL clause.
>
> *    UNION of two tables:
>
> mytable:            yourtable:
>          id|name               id|name
>          --+------             --+------
>           1|Smith               1|Soares
>           2|Jones               2|Panini
>           3|Soares
>
>
> SELECT mytable.id, mytable.name
> FROM mytable
> WHERE mytable.name LIKE 'S%'
>    UNION
>        SELECT yourtable.id, yourtable.name
>        FROM yourtable
>        WHERE yourtable.name LIKE 'S%';
>
> this is the result even if I don't specify ALL.
>                      id|name
>                      --+------
>                       1|Smith
>                       1|Soares
>                       3|Soares

The second column is duplicate, but the first is not.  It looks at all
columns to determine duplicates.

--
Bruce Momjian                          |  830 Blythe Avenue
maillist@candle.pha.pa.us              |  Drexel Hill, Pennsylvania 19026
  +  If your life is a hard drive,     |  (610) 353-9879(w)
  +  Christ can be your backup.        |  (610) 853-3000(h)

pgsql-hackers by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: Let's talk up 6.3
Next
From: "Vadim B. Mikheev"
Date:
Subject: Re: [HACKERS] Reminder: Indices are not used