RETURN QUERY still does not work perfect in Postgres 8.4

From: Michal Szymanski <mich20061(at)gmail(dot)com>
To: pgsql-bugs(at)postgresql(dot)org
Subject: RETURN QUERY still does not work perfect in Postgres 8.4
Date: 2009-07-03 10:57:40
Message-ID: c81e0acb-f74c-450e-bdde-2c5014b32946@e21g2000yqb.googlegroups.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Try this:
=============================
DROP TABLE bug_table;
CREATE TABLE "bug_table" (
"id" BIGINT NOT NULL,
test VARCHAR,
CONSTRAINT "test_table_pkey" PRIMARY KEY("id")
) WITHOUT OIDS;

DROP FUNCTION buggy_procedure();
CREATE FUNCTION buggy_procedure() RETURNS SETOF bug_table
AS $$
BEGIN
-- @todo hide password
RETURN QUERY (
SELECT *
FROM bug_table
);
END;
$$
LANGUAGE plpgsql STRICT SECURITY DEFINER;

SELECT * FROM buggy_procedure(); -- All Okey
ALTER TABLE bug_table DROP COLUMN test;
SELECT * FROM buggy_procedure(); -- Bug
=========================

For our system this bug (or functionality) is a big problem. We cannot
drop table and import data for modified table - some table are huge
and sometimes there are many references.

I've tried to use RETURN TABLE but I have also problem with this:
http://groups.google.pl/group/pgsql.general/browse_thread/thread/a028c9ed2663b69b?hl=pl#

Michal Szymanski
http://blog.szymanskich.net

Browse pgsql-bugs by date

  From Date Subject
Next Message Oleg Serov 2009-07-04 20:10:55 Diffrent column ordering after dump/restore tables with INHERITS
Previous Message Ashesh Vashi 2009-07-03 04:22:41 Re: [BUGS] BUG #4898: Graphical Query Builder Scrolling Constraints