Re: Q: unexpected result from SRF in SQL - Mailing list pgsql-hackers

From Joe Conway
Subject Re: Q: unexpected result from SRF in SQL
Date
Msg-id 3CF0FB27.4070806@joeconway.com
Whole thread Raw
In response to Q: unexpected result from SRF in SQL  (Ian Barwick <barwick@gmx.net>)
Responses Re: Q: unexpected result from SRF in SQL  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
Ian Barwick wrote:
> 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?

This is an illustration of why the expression SRF API isn't very useful 
for returning composite types ;)

The number is actually a pointer to the result row. There is no way 
under the expression API to get at the individual columns directly. If 
you're really curious, see contrib/dblink in 7.2.x for an example of a 
(ugly) workaround.

Joe




pgsql-hackers by date:

Previous
From: Oleg Bartunov
Date:
Subject: Re: strange update problem with 7.2.1
Next
From: Tom Lane
Date:
Subject: Re: COPY and views