Re: [HACKERS] is it possible to use LIMIT and INTERSECT ?

Поиск
Список
Период
Сортировка
От Hannu Krosing
Тема Re: [HACKERS] is it possible to use LIMIT and INTERSECT ?
Дата
Msg-id 380AD8C7.BBA3E3E9@tm.ee
обсуждение исходный текст
Ответ на Re: [HACKERS] is it possible to use LIMIT and INTERSECT ?  (Oleg Bartunov <oleg@sai.msu.su>)
Ответы Re: [HACKERS] is it possible to use LIMIT and INTERSECT ?
Список pgsql-hackers
Oleg Bartunov wrote:
> 
> Tom,
> 
> patch was applied smoothly to 6.5.2
> What's the syntax ?
> 
> select  a.msg_id, c.status_set_date, c.title
>         from Message_Keyword_map a, messages c, keywords d
>         where c.status_id =1 and d.name ~* 'moon'  and a.key_id=d.key_id
>         and c.msg_id=a.msg_id
> intersect
>         select  a.msg_id, a.status_set_date, a.title from messages a
>             where a.status_id = 1 and a.title ~* 'moon' limit 5;
> 
> produces (10 rows)
> 
> select  a.msg_id, c.status_set_date, c.title
>         from Message_Keyword_map a, messages c, keywords d
>         where c.status_id =1 and d.name ~* 'moon'  and a.key_id=d.key_id
>         and c.msg_id=a.msg_id limit 5
> intersect
>         select  a.msg_id, a.status_set_date, a.title from messages a
>             where a.status_id = 1 and a.title ~* 'moon' limit 5;
> 

As the limit is applied to the final result, I guess you can have only one 
LIMIT per query.

So try removing the limit 5 before intersect .

-----------
Hannu


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

Предыдущее
От: Zakkr
Дата:
Сообщение: Re: [HACKERS] to_char(), md5() (long)
Следующее
От: Oleg Bartunov
Дата:
Сообщение: Re: [HACKERS] is it possible to use LIMIT and INTERSECT ?