Re: Re: Query 'Bout A Bug.

Поиск
Список
Период
Сортировка
От Philip Warner
Тема Re: Re: Query 'Bout A Bug.
Дата
Msg-id 3.0.5.32.20000713130519.02059c10@mail.rhyme.com.au
обсуждение исходный текст
Ответ на Re: Query 'Bout A Bug.  (Bruce Momjian <pgman@candle.pha.pa.us>)
Список pgsql-hackers
At 22:30 12/07/00 -0400, Bruce Momjian wrote:
>[ Charset ISO-8859-1 unsupported, converting... ]
>> Bruce,
>>  
>> The bug list includes the following:
>>  
>> a.. SELECT foo UNION SELECT foo is incorrectly simplified to SELECT foo 
>> 
>> Wy is this simplification incorrect? I don't get it.
>
>Not sure.  Maybe someone can comment. 
>

As far as I can see, we'd need to know the definition of 'foo'.

eg. 
   select nextval('id') UNION SELECT nextval('id') 

should produce two rows. 

If foo is invariant, then you should be fine because the default behaviour
for union should be to do a set union of the tuples (ie. only *distinct*
rows are added to the result set). 

But, determining invariance is pretty hard for a complex foo (eg. a select
statement that causes rewrite rules to fire).

Finally, select 1 union ALL select 1

should produce two rows.

----------------------------------------------------------------
Philip Warner                    |     __---_____
Albatross Consulting Pty. Ltd.   |----/       -  \
(A.C.N. 008 659 498)             |          /(@)   ______---_
Tel: (+61) 0500 83 82 81         |                 _________  \
Fax: (+61) 0500 83 82 82         |                 ___________ |
Http://www.rhyme.com.au          |                /           \|                                |    --________--
PGP key available upon request,  |  /
and from pgp5.ai.mit.edu:11371   |/


В списке pgsql-hackers по дате отправления:

Предыдущее
От: Bruce Momjian
Дата:
Сообщение: Re: Query 'Bout A Bug.
Следующее
От: Tim Perdue
Дата:
Сообщение: Re: Some Improvement