=?UTF-8?Q?Grzegorz_Ja=C5=9Bkiewicz?= <gryzman(at)gmail(dot)com> writes:
> so my question is, why isn't postgres use index on some tables , and
> search for the X > N individually ?
The UNION arms have to all be the same data type in order to have
restrictions pushed down through the UNION. You did not show us
the table declarations for your first example, but I bet that updateid
isn't the same type in both. (And yes, a domain is different from its
underlying type for this purpose.)
In the second example, "1" isn't even the right base type let alone
the same domain.
regards, tom lane