Someone showed me this simple example:
regression=# CREATE TABLE test (a TEXT, b TEXT);
CREATE TABLE
regression=# INSERT INTO test VALUES ('foo', 'bar');
INSERT 17145 1
regression=# CREATE FUNCTION foo() RETURNS SETOF test as 'SELECT * FROM test' LANGUAGE sql;
CREATE FUNCTION
regression=# SELECT * FROM foo(); a | b
-----+-----foo | bar
(1 registro)
regression=# ALTER TABLE test DROP COLUMN a;
ALTER TABLE
regression=# SELECT * FROM foo();
ERROR: query-specified return row and actual function return row do not match
(note that I didn't "specify a return record" -- SETOF test should only
consider non-dropped columns ...)
--
Alvaro Herrera (<alvherre[a]dcc.uchile.cl>)
"La virtud es el justo medio entre dos defectos" (Aristóteles)