Re: coalesce function

Поиск
Список
Период
Сортировка
От David Johnston
Тема Re: coalesce function
Дата
Msg-id 1371828055818-5760342.post@n5.nabble.com
обсуждение исходный текст
Ответ на Re: coalesce function  (Chris Angelico <rosuav@gmail.com>)
Список pgsql-general
Chris Angelico wrote
> On Fri, Jun 21, 2013 at 7:36 AM, David Johnston <

> polobo@

> > wrote:
>>         SELECT input
>>         FROM ( SELECT unnest($1) AS input ) src
>>         WHERE input IS NOT NULL AND input <> ''
>>         LIMIT 1;
>
> Does this guarantee the order of the results returned? Using LIMIT
> without ORDER BY is something I've learned to avoid.
>
> ChrisA

I have thought about this and while I'm not 100% positive on the guarantee
the fact the input data is small means the planner should not be re-ordering
"src" in order to apply the where clause (if it would anyway...I think
re-ordering may only happen during joins).  To my knowledge the result of
unnest returns in the same order as the array so "src" already has an
implicit "ORDER BY" attached to it.  It is only when return physical
relation data is the order undefined.  Arrays and "VALUES" both are returned
in the order defined.

David J.





--
View this message in context: http://postgresql.1045698.n5.nabble.com/coalesce-function-tp5760161p5760342.html
Sent from the PostgreSQL - general mailing list archive at Nabble.com.


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

Предыдущее
От: David Johnston
Дата:
Сообщение: Re: Circular references
Следующее
От: Alan Nilsson
Дата:
Сообщение: Re: variadic args to C functions