Re: function retuning refcursor, order by ignored?

Поиск
Список
Период
Сортировка
От Michael Fuhr
Тема Re: function retuning refcursor, order by ignored?
Дата
Msg-id 20070530022912.GA73504@winnie.fuhr.org
обсуждение исходный текст
Ответ на function retuning refcursor, order by ignored?  (novnov <novnovice@gmail.com>)
Ответы Re: function retuning refcursor, order by ignored?  (novnov <novnovice@gmail.com>)
Re: function retuning refcursor, order by ignored?  (novnov <novnovice@gmail.com>)
Список pgsql-general
On Tue, May 29, 2007 at 05:18:42PM -0700, novnov wrote:
> It seems that at least in the way I've written the function below, ORDER BY
> is ignored.

Works here (see below).  Can you post a complete example that shows
ORDER BY being ignored?  Do you get different results from the
cursor than if you execute the same query directly?  What version
of PostgreSQL are you running?


CREATE TABLE t_item (
    item_id      integer PRIMARY KEY,
    item_name    text NOT NULL,
    item_org_id  integer NOT NULL,
    item_active  boolean NOT NULL
);

INSERT INTO t_item VALUES (4, 'four', 1, true);
INSERT INTO t_item VALUES (2, 'two', 1, true);
INSERT INTO t_item VALUES (1, 'one', 1, true);
INSERT INTO t_item VALUES (3, 'three', 1, true);

BEGIN;

SELECT proc_item_list(1, true);
   proc_item_list
--------------------
 <unnamed portal 1>
(1 row)

FETCH ALL FROM "<unnamed portal 1>";
 item_id | item_name | item_org_id | item_active
---------+-----------+-------------+-------------
       1 | one       |           1 | t
       2 | two       |           1 | t
       3 | three     |           1 | t
       4 | four      |           1 | t
(4 rows)

COMMIT;

--
Michael Fuhr

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

Предыдущее
От: Naz Gassiep
Дата:
Сообщение: Re: TimeZone List
Следующее
От: Francisco Reyes
Дата:
Сообщение: Re: Delete with subquery deleting all records