Re: problem with using fetch and a join.

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: problem with using fetch and a join.
Дата
Msg-id 15266.1040395673@sss.pgh.pa.us
обсуждение исходный текст
Ответ на problem with using fetch and a join.  (Noel <noel.faux@med.monash.edu.au>)
Список pgsql-novice
Noel <noel.faux@med.monash.edu.au> writes:
> begin;
> declare test cursor for
> select protein.accession
> from protein, region
> where protein.accession like '%1245%'
> and protein.accession = region.accession
> and region.protein_database = 1;
> fetch forward 2 in test;
> fetch backward 1 in test;

FETCH (or MOVE) BACKWARD doesn't work with most join plan types (or
indeed anything much more complex than a simple seqscan or indexscan).
There ought to be some logic in there to detect and complain about the
non-working cases, but right now I fear you just get the wrong answer
when any given routine doesn't pay attention to the direction flag :-(

I believe it will work when the top plan node is a Sort, so one possible
workaround is to add an explicit ORDER BY to the query.

            regards, tom lane

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

Предыдущее
От: Noel
Дата:
Сообщение: problem with using fetch and a join.
Следующее
От: "Josh Berkus"
Дата:
Сообщение: Re: Table referenced by OID in a view?