From: | Ian Barwick <barwick(at)gmx(dot)net> |
---|---|
To: | pgsql-hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Q: unexpected result from SRF in SQL |
Date: | 2002-05-26 06:28:12 |
Message-ID: | 200205260828.12643.barwick@gmx.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
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
From | Date | Subject | |
---|---|---|---|
Next Message | Neil Conway | 2002-05-26 06:32:01 | COPY and views |
Previous Message | Joe Conway | 2002-05-26 06:24:21 | sample SRF: SHOW ALL equiv C function returning setof composite |