Re: How to push predicate down - Mailing list pgsql-general

From Volodymyr Kostyrko
Subject Re: How to push predicate down
Date
Msg-id 4F216817.4080800@gmail.com
Whole thread Raw
In response to How to push predicate down  (salah jubeh <s_jubeh@yahoo.com>)
Responses Re: How to push predicate down  (salah jubeh <s_jubeh@yahoo.com>)
List pgsql-general
salah jubeh wrote:
>
> Hello Guys,
>
> In the past I had a view defined as follows
>
> CREATE view abcd as
> SELECT whatever ...... --- query1
>
> Some business requierments came up and I had to change it like this
>
> CREATE view abcd as
> SELECT whatever ...... --- query1
> UNION
> SELECT whatever ......---- query2

1. You sure you need UNION and not UNION ALL?

2. Can you post more detail example?

For example:

select anything from first_table
union
select anything from second_table
where anything == something;

This way WHERE clause is a part of second subselect and will not be
propagated to the first one.

--
Sphinx of black quartz judge my vow.

pgsql-general by date:

Previous
From: Szymon Guz
Date:
Subject: Re: Let-bindings in SQL statements
Next
From: "David Johnston"
Date:
Subject: Re: Let-bindings in SQL statements