From: | Michael Fuhr <mike(at)fuhr(dot)org> |
---|---|
To: | novnov <novnovice(at)gmail(dot)com> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: function retuning refcursor, order by ignored? |
Date: | 2007-05-30 02:29:12 |
Message-ID: | 20070530022912.GA73504@winnie.fuhr.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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
From | Date | Subject | |
---|---|---|---|
Next Message | Francisco Reyes | 2007-05-30 02:35:09 | Re: Delete with subquery deleting all records |
Previous Message | Naz Gassiep | 2007-05-30 02:13:16 | Re: TimeZone List |