On 23 April 2016 at 07:08, Manuel Gómez <targen@gmail.com> wrote:
> but its semantics can be rather wonky. Witness:
>
> postgres=# select 1;
> ?column?
> ----------
> 1
> (1 row)
>
> postgres=# select 1 union select 1;
> ?column?
> ----------
> 1
> (1 row)
Exactly what you would expect. Use UNION ALL to get two rows.
> postgres=# select;
> --
> (1 row)
>
> postgres=# select union select;
> --
> (2 rows)
SELECT with no values is selecting a NULL, and two NULLs do not
equate, so you would expect two rows.
> postgres=# select 1 intersect select 1;
> ?column?
> ----------
> 1
> (1 row)
>
> postgres=# select intersect select;
> --
> (2 rows)
See above.
Geoff