RETURN QUERY still does not work perfect in Postgres 8.4 - Mailing list pgsql-bugs

From Michal Szymanski
Subject RETURN QUERY still does not work perfect in Postgres 8.4
Date
Msg-id c81e0acb-f74c-450e-bdde-2c5014b32946@e21g2000yqb.googlegroups.com
Whole thread Raw
List 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

pgsql-bugs by date:

Previous
From: Ashesh Vashi
Date:
Subject: Re: BUG #4898: Graphical Query Builder Scrolling Constraints
Next
From: Oleg Serov
Date:
Subject: Diffrent column ordering after dump/restore tables with INHERITS