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