Using a recent build (22.5) from CVS, if I create a set returning function in SQL like this:
func_test=# CREATE TABLE foo (id INT, txt1 TEXT, txt2 TEXT); CREATE TABLE func_test=# INSERT INTO foo VALUES(1, 'Hello','World'); INSERT 24819 1 func_test=# func_test=# CREATE OR REPLACE FUNCTION bar(int) func_test-# RETURNS SETOF foo func_test-# AS 'SELECT * FROM foo WHERE id = $1' func_test-# LANGUAGE 'sql'; CREATE FUNCTION I can do this (expected result): func_test=# SELECT txt1, txt2 FROM bar(1); txt1 | txt2 -------+------- Hello | World (1 row) but also this: func_test=# select bar(1); bar ----------- 139059784 (1 row) What is this number? It often varies from query to query. Possibly an error-in-disguise because of something to do with the calling context? Just curious ;-) Ian Barwick ---------------------------(end of broadcast)--------------------------- TIP 5: Have you checked our extensive FAQ? http://www.postgresql.org/users-lounge/docs/faq.html