Re: Operations widh CURSORS

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Operations widh CURSORS
Дата
Msg-id 15212.959961270@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Operations widh CURSORS  (Marcos Barreto de Castro <mbdecastro@yahoo.com>)
Список pgsql-general
Marcos Barreto de Castro <mbdecastro@yahoo.com> writes:
>   I am issuing a "BEGIN WORK" statement, after that I
> am issuing "DECLARE c_cursor FOR SELECT * FROM table".
> When, after that, I issue "DECLARE c_cursor1 FOR
> SELECT COUNT(*) FROM table" I get a segmentation
> fault.

Seems to work fine for me ... what version are you using?

            regards, tom lane


regression=# create table foo(f1 int);
CREATE
regression=# insert into foo values(1);
INSERT 277673 1
regression=# insert into foo values(2);
INSERT 277674 1
regression=# insert into foo values(3);
INSERT 277675 1
regression=# insert into foo values(4);
INSERT 277676 1
regression=# begin;
BEGIN
regression=# DECLARE c_cursor CURSOR FOR SELECT * FROM foo;
SELECT
regression=# DECLARE c_cursor1 CURSOR FOR SELECT count(*) FROM foo;
SELECT
regression=# fetch 1 from c_cursor;
 f1
----
  1
(1 row)

regression=# fetch 1 from c_cursor1;
 count
-------
     4
(1 row)

regression=# fetch 1 from c_cursor;
 f1
----
  2
(1 row)

regression=# fetch 1 from c_cursor;
 f1
----
  3
(1 row)

regression=# fetch 1 from c_cursor;
 f1
----
  4
(1 row)

regression=# fetch 1 from c_cursor1;
 count
-------
(0 rows)

regression=# fetch 1 from c_cursor;
 f1
----
(0 rows)

regression=# end;
COMMIT

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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: query optimiser changes 6.5->7.0
Следующее
От: Richard Moon
Дата:
Сообщение: Anybody got Postgress Binaries working on NT ?